:: Re: [DNG] bash / quote weirdness
Inizio della pagina
Delete this message
Reply to this message
Autore: Hendrik Boom
Data:  
To: dng
Oggetto: Re: [DNG] bash / quote weirdness
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 course, the system has no command named "cat -n".  (And only a chaotic
> evil person would use a space in a command's name.) Something like
>     "cat"  "-n"  /etc/fstab


Maybe to keep anyone from executing a potentially danterous command by mistake?

-- hendrik

> would work fine, the shell now sees three tokens (and the double quotes are
> completely unnecessary here), and the first is recognized as a command
> that's on the executable path.
>
> The same goes for "cat /etc/fstab" or "cat fstab", they're both just text
> strings that happen to include a space character.
>
>
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng