0
0
I know how to change directory:
cd path
I know how to detach a process:
command &
,
nohup command > /tmp/test_output.txt 2>&1 &
,
nohup command > /dev/null 2>&1 &
,
disown command &
here's a good reference for that: How do I detach a process from Terminal, entirely?
But I don't know how to do them both at the same time, this seems to be impossible. Can anyone help me? Here are some things I have tried:
path/command
nohup cd path && command > /tmp/test_output.txt 2>&1 &
cd path && nohup command > /tmp/test_output.txt 2>&1 &
cd path && disown command &
(cd path && disown command &)
(cd path && command) &
cd path ; command &
I can get it to error, I can get it to go to that path and run (but not detached from my terminal) or I can get it to run the command detached from my terminal but at my current working directory, not the cd path.
I can't get it to detach the process from my terminal and run the command from a different directory than my own at the same time.
Can you help me with this? Is it even possible?