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
In some newer versions of bash and in ksh93 you can surround it with a sub-shell or process group (i.e. { ... }
).
/home/shellter $ { echo "Hello I'm a background task" & } 2>/dev/null
Hello I'm a background task
/home/shellter $
Try:
user@host:~$ read < <( echo "Hello I'm a background task" & echo $! )
user@host:~$ echo $REPLY
28677
And you have hidden both the output and the PID. Note that you can still retrieve the PID from $REPLY