在 Ruby 中,>> 被称为铲操作符。例如,在 bash 中它叫什么
cat "hello world" >> file.txt
Run Code Online (Sandbox Code Playgroud)
它如何使用正确的命名法解释这是做什么的。我听说它被称为“管道”,但管道是 | 所以我很困惑。
>将输出发送到文件时的正式名称是什么这是一个重定向操作符。
笔记:
|符号也可以非正式地称为重定向操作符,但正式它是一个控制操作符(请参阅外壳程序的控制和重定向操作符是什么? - Unix & Linux Stack Exchange)。命令的输入和输出都可以重定向:
Run Code Online (Sandbox Code Playgroud)command > filename Redirect command output (stdout) into a file command > /dev/null Discard stdout of command command 2> filename Redirect error output (stderr) to a file command 2>&1 filename Redirect stderr to stdout command 1>&2 filename Redirect stdout to stderr command >> filename Redirect command output and APPEND into a file command < filename Redirect a file into a command commandA < (commandB) Redirect the output of commandB as file input to commandA commandA | tee filename | commandB Redirect commandA into filename AND commandB commandA | commandB Redirect stdout of commandA to commandB commandA |& commandB Redirect stdERR of commandA to commandB
源操作方法:重定向和进程替换 - Linux - SS64.com
有关的: