I would like to create a command that will change directory, run a process in the background and then return to the original directory. It is important for the process to be started from a specific directory (It uses the running directory for relative paths).
I tried running this, but got the following error:
cd ~/work; myapp &> /dev/null &; cd -
-bash: syntax error near unexpected token `;'
I can run either of the following commands.
# Without the "&" that cause the process to run in the background
cd ~/work; myapp &> /dev/null; cd -
# Without the " cd -" which returns my to the original directory
cd ~/work; myapp &> /dev/null &
The purpose of this, is to be able to add this command to my aliases.