-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
弃之可惜
- -0[八进制](是数字零,不是大写字母0)
影响$/,$/ 描述读取输入的行分隔符。while line=gets puts line end
cli 中运行 ruby -0\141 test.rb
\141是“a"的八进制形式,可以输入bbaca试试
2. -00,将$/设置成两个\0,运行以上程序,需要两次回车
3. -777, 👎 试了试 不支持
4.-Cdirectory
程序在 /root/program目录,当前目录在/root目录, cli中 ruby -C/root/program test.rb
5.-d,--debug(👎不会用)
6.-e 'command' 相当于py -c
7 -I (大写字母i) 路径
ruby -I /root -I /tmp test.rb
修改$:
相当于py 中PYTHONPATH
8.-a ,不知道和-p ,-n 什么关系 👎
9. -c 只做语法检查
其他
% ruby –n –e "print if /wombat/" *.txt
-p Places your program code within the loop while gets; ...; print; end.
% ruby –p –e "$_.downcase!" *.txt
除了使用大写字母I ,还可以设定RUBYLIB环境变量,在程序中修改$:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels