Sequentially run commands in bash script
问题 I need to run two commands sequentially in daemon mode (the commands will output the errors on stderr). The problem is that even I dump all the output in /dev/null, the second command (run_cmd2) cannot be invoked. Here is my script #! /bin/bash nohup ./run_cmd1 &> /dev/null & nohup ./run_cmd2 &> /dev/null & Any ideas? Thank you in advance. 回答1: How about using a file to communicate state? run_cmd2 will wait until a file exists before running when run_cmd1 is done, it will create the said file