在shell中,&|代表什么意思?
在shell中,&
会导致进程与父进程(在这种情况下是shell)分离,但不会从父进程中脱离,这意味着当你关闭shell时,你启动的进程也会关闭。
要完全脱离shell,你需要这样做:my_process &
,然后disown %1
。
根据在zsh
上运行的&|
命令的信息,&|
的意思是:
&| - 将管道的最后一个命令放入后台执行。
那管道呢?我在手册中找不到关于&|
的标记,但我猜它在这里有特殊的含义,对吗?
实际上,我也没有找到管道的任何文档,并且在我的shell中尝试了一下,得到了:bash: syntax error near unexpected token |'
。
我使用的是zsh,&|
与&
是不同的。我尝试了jobs
,但没有任何输出。
在Shell中,&| 是一个用于移除作业的命令,通过该命令可以从作业表中删除指定的作业。一旦作业被移除,Shell将不再报告其状态,并且在尝试退出一个正在运行或停止的交互式Shell时,Shell也不会发出警告。如果没有指定作业,则默认移除当前作业。
这个问题产生的原因是用户想要了解在Shell中 &| 的含义。在Linux的zsh内置命令手册中,可以找到该命令的描述。用户还可以通过参考Stack Overflow上的一个问题,进一步理解该命令的使用场景。
解决这个问题的方法是查阅相关文档和资源,如zsh内置命令手册以及Stack Overflow上的讨论。通过阅读这些资源,用户可以了解到 &| 命令的具体用法和效果。如果还有疑问,用户可以进一步寻找其他相关的资料或向社区提问以获取更多帮助。
通过查阅相关文档和资源,用户可以了解 &| 命令在Shell中的含义和用法,并且可以解决对该命令的疑问。
|
is a pipe operator that redirects the output of one command as the input of another command.
When used together, &
and |
have a special meaning in shell scripting. They are used to run multiple commands simultaneously and redirect the output of one command as the input of another command.
For example, if we have two commands: command1 and command2, we can run them simultaneously and redirect the output of command1 as the input of command2 using the &
and |
operators.
The syntax for using &|
in shell scripting is:
command1 &| command2
This means that command1 will run in the background and its output will be sent as the input to command2. This allows for parallel execution of multiple commands and efficient handling of large amounts of data.
To summarize, the &|
operator in shell scripting is used to run multiple commands simultaneously and redirect the output of one command as the input of another command. It is particularly useful for handling large amounts of data and improving the efficiency of command execution.