← 返回命令列表

Linux command

rubish 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start

rubish

Run

rubish -c '[echo hello]'

Execute

rubish [script.sh]

Start

rubish -r

Pipe

rubish -c '[ls().sort.uniq]'

说明

rubish is an interactive UNIX shell implemented entirely in Ruby. It parses familiar bash syntax and compiles it to Ruby for execution, so existing scripts keep working while the full Ruby language becomes available on the command line. It can be used as a login shell via chsh. The shell blurs the line between shell and scripting language. External commands return objects that can be chained with dot notation (for example ls().sort.uniq), output can be processed line by line with Ruby iterators such as .each and .map, and Ruby expressions may be used as conditions in if, while, and until by wrapping them in { }. A line beginning with a capital letter is evaluated directly as Ruby code, and functions can be defined with Ruby's def...end syntax. For familiarity it also supports a number of zsh conveniences, including setopt, autoload, and abbreviated path expansion, along with custom dynamically-generated prompts and lazy loading of slow initializations in background threads.

参数

-c _command_
Execute _command_ as a single string and exit.
-r
Restricted mode: disable Ruby integration features for running untrusted scripts.

FAQ

What is the rubish command used for?

rubish is an interactive UNIX shell implemented entirely in Ruby. It parses familiar bash syntax and compiles it to Ruby for execution, so existing scripts keep working while the full Ruby language becomes available on the command line. It can be used as a login shell via chsh. The shell blurs the line between shell and scripting language. External commands return objects that can be chained with dot notation (for example ls().sort.uniq), output can be processed line by line with Ruby iterators such as .each and .map, and Ruby expressions may be used as conditions in if, while, and until by wrapping them in { }. A line beginning with a capital letter is evaluated directly as Ruby code, and functions can be defined with Ruby's def...end syntax. For familiarity it also supports a number of zsh conveniences, including setopt, autoload, and abbreviated path expansion, along with custom dynamically-generated prompts and lazy loading of slow initializations in background threads.

How do I run a basic rubish example?

Run `rubish` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -c _command_ do in rubish?

Execute _command_ as a single string and exit.