开发者

ARGV ignores # sign

开发者 https://www.devze.com 2023-03-26 20:08 出处:网络
Here is my script #!/usr/bin/env ruby puts ARGV.inspect Here is test $ argvtest fixed progress bar closes #88

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号