Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Carlos E. R." Newsgroups: comp.os.linux.misc Subject: Re: correct quoting for variables in bash scripts? Date: Mon, 17 Oct 2022 14:39:55 +0200 Lines: 23 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net C3RgFGNW3bgW9Zv7MnBWVQM1RZjr91q6/X0UaB00P+zAix+A7s Cancel-Lock: sha1:QxgQuLz6MP0HNZFUZE+uWzJrxDI= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Content-Language: es-ES, en-CA In-Reply-To: Xref: csiph.com comp.os.linux.misc:35735 On 17/10/2022 13.28, Barry Stir wrote: > I see various formats, such as >   if [[ -L ${LINK1_DIR} ]]; then > >   if [[ -L "$LINK1_DIR" ]]; then > > rather than just $LINK1_DIR > I presume this is insurance to ensure script works in every version of > Red Hat, Debian, Arch whatever... There are no differences among distributions. Bash is bash everywhere. > So which is the ideal extra character to put around the environment > variable? Others have explained it well in their posts. -- Cheers, Carlos E.R.