:: Re: [DNG] [OT] bash / quote weirdne…
Top Page
Delete this message
Reply to this message
Author: Gabe Stanton
To: dng
Subject: Re: [DNG] [OT] bash / quote weirdness
I don't have anything of my own to add except that single quotes result
in the same behavior as double quotes in this case.
I was curious about that after reading about the difference between
single and double quotes in the Advanced Bash Scripting Guide or abs
guide. I'm a novice obviously.

I wanted to share the abs guide in case anyone reading isn't aware of
it. I found it recently while working on a script myself (rename files
and folders according to a standard, all lower case, limited special
characters and no spaces in case anyone finds it interesting).

There's an html version and a pdf version of the abs guide available


or here



On Wed, 2022-01-12 at 00:08 +0100, Florian Zieboll via Dng wrote:
> Dear list,
> this im my 'test.sh':
> #!/bin/bash
> for f in "$@" ; do
>     xcmd="unrar x"
>     $xcmd "$f"
> done

> Can please somebody explain, why, if I double-quote the "$xcmd"
> variable in line 4, the script fails with
>     ./test.sh: line 4: unrar x: command not found

> ???
> Commands without parameters resp. whitespace (e.g. xcmd="unzip") work
> fine when double-quoted; a web search (including the "GNU Bash
> manual"
> [1]) did not shed any light on this mystery...
> Thank you and libre Grüße,
> Florian
> [1]
> https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng