:: Re: [DNG] bash / quote weirdness
Forside
Slet denne besked
Besvar denne besked
Skribent: Steve Litt
Dato:  
Til: dng
Emne: Re: [DNG] bash / quote weirdness
. 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 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
>
>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     is     correct    !



SteveT

Steve Litt
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques