In writing a script that takes strings on the command line I have run
into a small problem which I don’t see any way around. Here is a very
simplified program that just prints out the first command line argument,
and using p you can see exactly what is in the string.
[example.rb]
p $*[0]
Now when I send some different (but similar) strings I end up with the
same result in the ARGV array:
$ ruby example.rb “\a”
“\a”
$ ruby example.rb “\a”
“\a”
$ ruby example.rb \\a
“\a”
- Is this because I am running in bash and the shell maps the \ into a
single backslash? - Is there any way around this in Ruby or from the command line (in
bash) so that I can differentiate between these?
Thanks,
Joseph P.