超時參數,我可以使用超時爲:組成的命令,在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)'。 –