How to run multiple command in one line and some commands in background at the same time?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I know I can use &
at the end of a command to make it run in background and &&
to connect multiple commands at the same line. However, when I use them together it seems not work. Below is an example.
json-server --watch db.json & && python -m http.server 7777
The error message is:
bash: syntax error near unexpected token `&&'
Is it possible to make them work together? Thanks.
command-line background-process
add a comment |Â
up vote
0
down vote
favorite
I know I can use &
at the end of a command to make it run in background and &&
to connect multiple commands at the same line. However, when I use them together it seems not work. Below is an example.
json-server --watch db.json & && python -m http.server 7777
The error message is:
bash: syntax error near unexpected token `&&'
Is it possible to make them work together? Thanks.
command-line background-process
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I know I can use &
at the end of a command to make it run in background and &&
to connect multiple commands at the same line. However, when I use them together it seems not work. Below is an example.
json-server --watch db.json & && python -m http.server 7777
The error message is:
bash: syntax error near unexpected token `&&'
Is it possible to make them work together? Thanks.
command-line background-process
I know I can use &
at the end of a command to make it run in background and &&
to connect multiple commands at the same line. However, when I use them together it seems not work. Below is an example.
json-server --watch db.json & && python -m http.server 7777
The error message is:
bash: syntax error near unexpected token `&&'
Is it possible to make them work together? Thanks.
command-line background-process
command-line background-process
asked Aug 19 at 14:48
Ogrish Man
4711414
4711414
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
5
down vote
accepted
It seems you want this
json-server --watch db.json & python -m http.server 7777
The &&
is not to connect multiple commands at the same line, that is ;
. The &&
is a logical AND. You can't use an AND if you don't wait for the command to exit.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
It seems you want this
json-server --watch db.json & python -m http.server 7777
The &&
is not to connect multiple commands at the same line, that is ;
. The &&
is a logical AND. You can't use an AND if you don't wait for the command to exit.
add a comment |Â
up vote
5
down vote
accepted
It seems you want this
json-server --watch db.json & python -m http.server 7777
The &&
is not to connect multiple commands at the same line, that is ;
. The &&
is a logical AND. You can't use an AND if you don't wait for the command to exit.
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
It seems you want this
json-server --watch db.json & python -m http.server 7777
The &&
is not to connect multiple commands at the same line, that is ;
. The &&
is a logical AND. You can't use an AND if you don't wait for the command to exit.
It seems you want this
json-server --watch db.json & python -m http.server 7777
The &&
is not to connect multiple commands at the same line, that is ;
. The &&
is a logical AND. You can't use an AND if you don't wait for the command to exit.
answered Aug 19 at 14:56
RalfFriedl
3,7351623
3,7351623
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f463508%2fhow-to-run-multiple-command-in-one-line-and-some-commands-in-background-at-the-s%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password