I have a program that receives an argument and prints it every second:
~# ./myapp 234
234
234
234
234
...
I want to be able to run it in the background and right after a shell but it must be in one line (I don't want to explain why I need it because I don't want to make the discussion too complicated right now).
This is what I tried and the error I received:
~# bash -c "./myapp 234 &; sh"
bash: -c: line 0: syntax error near unexpected token `;'
bash: -c: line 0: `./myapp 234 &; sh'
I also tried with &&
as separator:
~# bash -c "./myapp 234 & && sh"
bash: -c: line 0: syntax error near unexpected token `&&'
bash: -c: line 0: `./myapp 234 & && sh'
Any idea how I can solve it?
EDIT:
Thanks to @roaima.
I also found a link that talks about it:
How to run a program in background and also using && to execute another command