On Wed, 12 Jan 2022 01:10:11 +0100
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
On Tue, 11 Jan 2022 18:52:10 -0500
william moss wrote:
> Bash is taking the string in the double quotes as a single command;
> this is well documented. If either the command or parameters have
> spaces, you will have to use eval. Check the bash man page for
> details.
>
> This will also usually
On Tue, 11 Jan 2022 18:16:15 -0500
tempforever wrote:
> I believe quoting $xcmd would instruct the shell to look for and
> execute "unrar x" so unless you have an executable file named unrar\
> x within $PATH, it will fail. The same thing happens within a shell:
> ~$ "unrar x"
> bash: unrar x: c
On Wednesday 12 January 2022 at 00:08:38, Florian Zieboll via Dng wrote:
> #!/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: un
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
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 paramete