:: Re: [DNG] [OT] bash / quote weirdne…
Page principale
Supprimer ce message
Répondre à ce message
Auteur: Florian Zieboll
Date:  
À: dng
Sujet: Re: [DNG] [OT] bash / quote weirdness
On Wed, 12 Jan 2022 01:10:11 +0100
Antony Stone <Antony.Stone@???> wrote:

> Double-quoting turns the string into a single token, and therefore
> the parser sees the line as:
>
>     token 1 = "unrar x"
>     token 2 = "$f"

>
> Without the double quoting, it's:
>
>     token 1 = "unrar"
>     token 2 = "x"
>     token 3 = "$f"

>
> "unrar" is a command which can be executed (in this case with a
> parameter of "x"), whereas "unrar x" is not a command.
>
> You can see much the same thing if you try:
>
> for f in one two three four
> do
> echo "$f"
> done
>
> for f in "one two" "three four"
> do
> echo "$f"
> done
>
>
> Antony.



Hallo Antony,

thank you - and yes, of course, that makes perfectly sense... As I have
a strict "no whitespace policy" for my filesystems, I just wouldn't
ever have thought of a command to contain one - and am still somewhat
dumbfounded ;-)

Libre Grüße,
Florian