当我尝试结合另一个命令在远程主机上执行 pkill 时,它总是返回 255,即使这两个命令都成功了。
例子
ssh <remoteHost> 'pkill -f xyz' # returns 0 (rightly so when xyz is a process)
ssh <remoteHost> 'source /etc/profile' # returns 0 (rightly so)
但是当我运行组合命令时:
ssh <remoteHost> 'source /etc/profile; pkill -f xyz' # returns 255 - why?
将“pkill”与另一个命令结合起来有些东西,因为即使它是一个组合,以下命令也会返回零:
ssh <remoteHost> 'source /etc/profile; ls' # returns 0
假设xyz
当我们试图杀死它时它一直在运行。
我不明白这种行为。为什么在案例 3 中返回 255?