:: [DNG] [OT] bash / quote weirdness
Etusivu
Poista viesti
Vastaa
Lähettäjä: Florian Zieboll
Päiväys:  
Vastaanottaja: [DNG]
Aihe: [DNG] [OT] bash / quote weirdness

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