超时参数,我可以使用超时为:组成的命令,在bash
timeout 5s sleep 6s
但我怎么能传递给更多的超时复杂的命令?我试过以下,但所有给我的错误:几乎立即
timeout 5s sleep 6s && echo "You did not fit in timeout"
timeout 5s 'sleep 6s && echo "You did not fit in timeout"'
timeout 5s {sleep 6s && echo "You did not fit in timeout"}
timeout 5s (sleep 6s && echo "You did not fit in timeout")
为什么你的&&被睡眠理解,而我的睡眠不是? –
@WakanTanka:交互式shell解释'&&'和'||':如果'timeout'返回0,'&&'部分触发,否则执行'||'部分。如果该命令在超时过期之前终止,则超时的退出代码将为0;否则,请参阅联机帮助页'timeout(1)'。 –