Running bash commands in the background without printing job and process ids

前端 未结 8 1351
余生分开走
余生分开走 2020-12-07 22:09

To run a process in the background in bash is fairly easy.

$ echo \"Hello I\'m a background task\" &
[1] 2076
Hello I\'m a background task
[1]+  Done             


        
8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 22:15

    Building on the above answer, if you need to allow stderr to come through from the command:

    f() { echo "Hello I'm a background task" >&2; }
    { f 2>&3 &} 3>&2 2>/dev/null
    

提交回复
热议问题