3 ms·
$ (sleep 10; /tmp/a.out id) & $ -> the end of the prompt of a "normal" (i. e. non-root) user () -> run everything inside in a forked subshell of the current s
by c0l0 8y ago
$ (sleep 10; /tmp/a.out id) &
$ -> the end of the prompt of a "normal" (i. e. non-root) user
() -> run everything inside in a forked subshell of the current shell
sleep 10 -> "block"/sleep for 10 seconds via the `sleep` executable in your $PATH
; -> after the left-hand side terminates, proceed with the next command on the right-hand side
/tmp/a.out id -> fork and exec the program located at /tmp/a.out with the literal byte sequence "id" on its argument vector
& -> run this command (the whole subshell that () requests) as a background job
When the user exits the shell that spawned the subshell, the whole process group will receive SIGHUP. The backgrounded subshell will still continue running, and after its `sleep` child process terminates, go on to run `/tmp/a.out`.
- blauditore 8y agoAh thanks, I didn't understand the subshell forking part before.