我必须用 C 语言编写自己的 shell,目前我正在处理 > < >> <<
运营商。我处理|
(管道)但我无法理解分割线路的所有优先级。
对于像 ls -la | cat -e ; ps
这样的东西我会做ls -la | cat -e
然后是 ps
,没什么难的。
随着重定向< > << >>
运算符的优先顺序是什么?
最佳答案
shell 按照重定向操作符出现的顺序(或者从命令的开始到结束,从左到右)处理重定向操作符。
此行为是specified by POSIX :
If more than one redirection operator is specified with a command, the order of evaluation is from beginning to end.
关于c - shell 如何处理重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33906577/