Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: [SHELL] Detect backslash in command line args

by choroba (Abbot)
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
Re^2: [SHELL] Detect backslash in command line args
by soonix (Deacon) 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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043129]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-09-18 01:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (103 votes), past polls