executing bash loop while command is running

前端 未结 4 1095
情歌与酒
情歌与酒 2020-12-12 20:05

I want to build a bash script that executes a command and in the meanwhile performs other stuff, with the possibility of killing the command if the script is killed. Say, ex

4条回答
  •  眼角桃花
    2020-12-12 20:13

    What you want is to do two things at once in shell. The usual way to do that is with a job. You can start a background job by ending the command with an ampersand.

    copy $SOURCE $DEST & 
    

    You can then use the jobs command to check its status.

    Read more:

    • Gnu Bash Job Control

提交回复
热议问题