Linux command
rc 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start an interactive rc shell
rc
Execute a script
rc [script.rc]
Execute a command string
rc -c '[command]'
Start rc without reading profile
rc -n
Start a login shell
rc -l
说明
rc is the Plan 9 command interpreter, offering a cleaner alternative to the Bourne shell. Originally designed for Plan 9 from Bell Labs, it has been ported to Unix systems and provides a simpler, more consistent syntax. Unlike the Bourne shell's string variables, rc provides list-valued variables (arrays of strings) as a fundamental type. This eliminates many quoting problems and makes argument handling more natural. Rc uses C-like syntax for control structures: if, while, for, switch, and fn for function definitions. The syntax is defined by a formal grammar (implemented with yacc), making it unambiguous and predictable. Pipes, redirections, and command substitution work similarly to other shells. Background execution uses &, and command grouping uses {} instead of subshells.
参数
- -c _command_
- Execute the given command string and exit
- -e
- Exit if any command returns non-zero status
- -i
- Run interactively (read commands from terminal)
- -l
- Behave as a login shell (read profile)
- -n
- Do not read the personal profile ($home/lib/profile)
- -v
- Echo input to standard error as it is read
- -x
- Print commands and arguments as they are executed
FAQ
What is the rc command used for?
rc is the Plan 9 command interpreter, offering a cleaner alternative to the Bourne shell. Originally designed for Plan 9 from Bell Labs, it has been ported to Unix systems and provides a simpler, more consistent syntax. Unlike the Bourne shell's string variables, rc provides list-valued variables (arrays of strings) as a fundamental type. This eliminates many quoting problems and makes argument handling more natural. Rc uses C-like syntax for control structures: if, while, for, switch, and fn for function definitions. The syntax is defined by a formal grammar (implemented with yacc), making it unambiguous and predictable. Pipes, redirections, and command substitution work similarly to other shells. Background execution uses &, and command grouping uses {} instead of subshells.
How do I run a basic rc example?
Run `rc` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c _command_ do in rc?
Execute the given command string and exit