Re: [DNG] bash / quote weirdness

2022-01-14 Thread Steve Litt
Benjamin Riefenstahl said on Fri, 14 Jan 2022 10:33:29 +0100 >Hi Steve, > >> Benjamin Riefenstahl said on Thu, 13 Jan 2022 18:19:23 +0100 >>>Different code paths within Bash. [...] > >Steve Litt writes: >> This is true, but not the explanation for this particular behavior, >> as follows: >> >

Re: [DNG] bash / quote weirdness

2022-01-14 Thread Olaf Meeuwissen via Dng
Hi, Steve Litt writes: > Benjamin Riefenstahl said on Thu, 13 Jan 2022 18:19:23 +0100 > >>Hi Steve, >> >>Steve Litt writes: >>> [slitt@mydesk ~]$ "cat -n" /etc/fstab | cut -b 1-20 | head -n5 >>> bash: cat -n: command not found >>> [slitt@mydesk ~]$ "cat -n /etc/fstab" | cut -b 1-20 | head -n5

Re: [DNG] bash / quote weirdness

2022-01-14 Thread Benjamin Riefenstahl
Hi Steve, > Benjamin Riefenstahl said on Thu, 13 Jan 2022 18:19:23 +0100 >>Different code paths within Bash. [...] Steve Litt writes: > This is true, but not the explanation for this particular behavior, as > follows: > > [slitt@mydesk ~]$ /usr/bin/cat -n /etc/fstab | cut -b 1-20 | head -n5 >

Re: [DNG] bash / quote weirdness

2022-01-13 Thread Steve Litt
Hendrik Boom said on Thu, 13 Jan 2022 18:15:28 -0500 >On Thu, Jan 13, 2022 at 12:45:09PM -0500, . via Dng wrote: > >> >> The shell receives a series of tokens, and tries to interpret the >> first one as a command.  In the double-quoted attempt above, it gets >> two tokens before the first pipe |

Re: [DNG] bash / quote weirdness

2022-01-13 Thread Steve Litt
. via Dng said on Thu, 13 Jan 2022 12:45:09 -0500 >The shell receives a series of tokens, and tries to interpret the >first one as a command.  In the double-quoted attempt above, it gets >two tokens before the first pipe | --- > >     1) "cat -n" > >     2) /etc/fstab > >Of course, the system has

Re: [DNG] bash / quote weirdness

2022-01-13 Thread Steve Litt
Benjamin Riefenstahl said on Thu, 13 Jan 2022 18:19:23 +0100 >Hi Steve, > >Steve Litt writes: >> [slitt@mydesk ~]$ "cat -n" /etc/fstab | cut -b 1-20 | head -n5 >> bash: cat -n: command not found >> [slitt@mydesk ~]$ "cat -n /etc/fstab" | cut -b 1-20 | head -n5 >> bash: cat -n /etc/fstab: No such

Re: [DNG] bash / quote weirdness

2022-01-13 Thread Antony Stone
On Friday 14 January 2022 at 00:15:28, Hendrik Boom wrote: > On Thu, Jan 13, 2022 at 12:45:09PM -0500, . via Dng wrote: > > The shell receives a series of tokens, and tries to interpret the first > > one as a command. In the double-quoted attempt above, it gets two > > tokens before the first pip

Re: [DNG] bash / quote weirdness

2022-01-13 Thread Hendrik Boom
On Thu, Jan 13, 2022 at 12:45:09PM -0500, . via Dng wrote: > > The shell receives a series of tokens, and tries to interpret the first one > as a command.  In the double-quoted attempt above, it gets two tokens before > the first pipe | --- > >     1) "cat -n" > >     2) /etc/fstab > > Of cour

Re: [DNG] bash / quote weirdness

2022-01-13 Thread . via Dng
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.

Re: [DNG] bash / quote weirdness

2022-01-13 Thread Benjamin Riefenstahl
Hi Steve, Steve Litt writes: > [slitt@mydesk ~]$ "cat -n" /etc/fstab | cut -b 1-20 | head -n5 > bash: cat -n: command not found > [slitt@mydesk ~]$ "cat -n /etc/fstab" | cut -b 1-20 | head -n5 > bash: cat -n /etc/fstab: No such file or directory > [slitt@mydesk ~]$ Different code paths within B