📄 03 - testing whether a program is running interactively.rb
字号:
#!/usr/bin/ruby -w# interactive_or_not.rbif STDIN.tty? puts "Let me be the first to welcome my human overlords."else puts "How goes the revolution, brother software?"end#---$ ./interactive_or_not.rbLet me be the first to welcome my human overlords.$ echo "Some data" | interactive_or_not.rbHow goes the revolution, brother software?$ ./interactive_or_not.rb < input_fileHow goes the revolution, brother software?#---
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -