Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: [SHELL] Detect backslash in command line args

by choroba (Bishop)
on Jul 08, 2013 at 14:17 UTC ( #1043129=note: print w/replies, xml ) Need Help??

in reply to [SHELL] Detect backslash in command line args

I am not sure about cmd.exe, but for *nix shells, it is not possible. The backslash is interpreted by the shell running the prompt, which means the script gets the string without the backslash.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re: [SHELL] Detect backslash in command line args

Replies are listed 'Best First'.
Re^2: [SHELL] Detect backslash in command line args
by soonix (Monsignor) on Jul 08, 2013 at 17:18 UTC
    Yes, that's one of the bigger differences between the MS family and the Unix family. In Unix it's the shell's task to do command line parsing, globbing, etc. while COMMAND.COM and CMD.EXE just call the program and let it do all the rest. So, the answer to the OP: in Unixish systems, there isn't.

      You can probably demonstrate that effect with:

      echo comma\nd with backslash | cat -v

      But the shell will parse the backslash - so in one sense, you don't actually _need_ to detect it, because it isn't there any more by the time your script uses it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043129]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2018-01-21 15:32 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (228 votes). Check out past polls.