ARGV ignores # sign
Here is my script
#!/usr/bin/env ruby
puts ARGV.inspect
Here is test
$ argvtest fixed progress bar closes #88
["fixed", "progress", "开发者_运维百科bar", "closes"]
How do I fix my argvtest such that I could capture #88
Bash ignores everything after the #
sign. Call it like this:
$ echo foo \#bar
or this
$ echo foo '#bar'
This is a problem with the shell; # is a comment character to the shell.
You should be able to put that argument in quotes:
$ argvtest fixed progress bar closes "#88"
You will need the argument in quotes.
#88
is never sent to the script as it's the syntax for comments in most shells.
Try \#88
精彩评论