Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: [SHELL] Detect backslash in command line args

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

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

Backslash is an escape character which needs to be escaped ... you might already guess ... with a backslash.

The shell doesn't act very different to double-quoted strings in Perl.


You have a misconception here

> With MS Windows's cmd.exe shell we can force an exception if any args passed via the command line contain a backslash:

the same with Unix, just

> So ... if someone does perl arg\one in one of these shells, is there any way that can detect the backslash contained in that command line argument ?

In your example you are not passing a backslash, just an escaped "o", which is most probably just a simple "o". To be able to pass a backslash you need to double it!!!

Cheers Rolf

( addicted to the Perl Programming Language)

) yep

lanx@nc10-ubuntu:~$ perl -le 'print ord(chomp($ARGV[0]))' \o 48 lanx@nc10-ubuntu:~$ perl -le 'print ord(chomp($ARGV[0]))' o 48

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043131]
[Discipulus]: when I was used to hand writing I reached a very good level, but chars were ~1mm
[LanX]: choroba: another way of gaining XP is up-voting my posts ... (works always!)
[moritz]: works always, one third of the time! :-)
[LanX]: Bah mine are different. Proof otherwise!

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2017-09-26 11:39 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (293 votes). Check out past polls.