using curly braces to run multiple commands that have spaces [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
This question already has an answer here:
Why doesn't systemctl restart,status sshd; work?
3 answers
i have recently learned how can i use curly braces to run multiple commands using curly braces
for example, i can create 10
files like this,
touch 1..10.txt
or file with odd names,
touch 1..10..2
I can also restart multiple process like,
systemctl restart app9-server,client,test
above command will restart services called, app9-server
, app9-client
and app9-test
now i have a command with a space in it,
vagrant destroy app9
vagrant up app9
vagrant ssh app9
how can i run above 3 commands using braces?
I tried,
vagrant destroy app9,up app9,ssh app9
and
vagrant destroy,up,ssh app9
but none of them actually works.
Can someone please tell me how can i run these commands using braces?
terminal
marked as duplicate by muru, Tomasz, G-Man, Kusalananda, Goro Oct 1 at 5:44
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
0
down vote
favorite
This question already has an answer here:
Why doesn't systemctl restart,status sshd; work?
3 answers
i have recently learned how can i use curly braces to run multiple commands using curly braces
for example, i can create 10
files like this,
touch 1..10.txt
or file with odd names,
touch 1..10..2
I can also restart multiple process like,
systemctl restart app9-server,client,test
above command will restart services called, app9-server
, app9-client
and app9-test
now i have a command with a space in it,
vagrant destroy app9
vagrant up app9
vagrant ssh app9
how can i run above 3 commands using braces?
I tried,
vagrant destroy app9,up app9,ssh app9
and
vagrant destroy,up,ssh app9
but none of them actually works.
Can someone please tell me how can i run these commands using braces?
terminal
marked as duplicate by muru, Tomasz, G-Man, Kusalananda, Goro Oct 1 at 5:44
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Doesvagrant destroy app9 up app9 ssh app9
orvagrant destroy up ssh app9
work?
â muru
Oct 1 at 3:34
no it doesn't butvagrant destroy app9 && vagrant up app9 && vagrant ssh app9
does.
â MaverickD
Oct 1 at 3:39
when i runvagrant destroy app9,up app9,ssh app9
it outputs as if i ranvagrant
command only without any parameters
â MaverickD
Oct 1 at 3:41
1
So you need to run those as separate commands, and brace expansion won't help much with that. See dupe^
â muru
Oct 1 at 3:43
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
Why doesn't systemctl restart,status sshd; work?
3 answers
i have recently learned how can i use curly braces to run multiple commands using curly braces
for example, i can create 10
files like this,
touch 1..10.txt
or file with odd names,
touch 1..10..2
I can also restart multiple process like,
systemctl restart app9-server,client,test
above command will restart services called, app9-server
, app9-client
and app9-test
now i have a command with a space in it,
vagrant destroy app9
vagrant up app9
vagrant ssh app9
how can i run above 3 commands using braces?
I tried,
vagrant destroy app9,up app9,ssh app9
and
vagrant destroy,up,ssh app9
but none of them actually works.
Can someone please tell me how can i run these commands using braces?
terminal
This question already has an answer here:
Why doesn't systemctl restart,status sshd; work?
3 answers
i have recently learned how can i use curly braces to run multiple commands using curly braces
for example, i can create 10
files like this,
touch 1..10.txt
or file with odd names,
touch 1..10..2
I can also restart multiple process like,
systemctl restart app9-server,client,test
above command will restart services called, app9-server
, app9-client
and app9-test
now i have a command with a space in it,
vagrant destroy app9
vagrant up app9
vagrant ssh app9
how can i run above 3 commands using braces?
I tried,
vagrant destroy app9,up app9,ssh app9
and
vagrant destroy,up,ssh app9
but none of them actually works.
Can someone please tell me how can i run these commands using braces?
This question already has an answer here:
Why doesn't systemctl restart,status sshd; work?
3 answers
terminal
terminal
asked Oct 1 at 3:27
MaverickD
414
414
marked as duplicate by muru, Tomasz, G-Man, Kusalananda, Goro Oct 1 at 5:44
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by muru, Tomasz, G-Man, Kusalananda, Goro Oct 1 at 5:44
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Doesvagrant destroy app9 up app9 ssh app9
orvagrant destroy up ssh app9
work?
â muru
Oct 1 at 3:34
no it doesn't butvagrant destroy app9 && vagrant up app9 && vagrant ssh app9
does.
â MaverickD
Oct 1 at 3:39
when i runvagrant destroy app9,up app9,ssh app9
it outputs as if i ranvagrant
command only without any parameters
â MaverickD
Oct 1 at 3:41
1
So you need to run those as separate commands, and brace expansion won't help much with that. See dupe^
â muru
Oct 1 at 3:43
add a comment |Â
1
Doesvagrant destroy app9 up app9 ssh app9
orvagrant destroy up ssh app9
work?
â muru
Oct 1 at 3:34
no it doesn't butvagrant destroy app9 && vagrant up app9 && vagrant ssh app9
does.
â MaverickD
Oct 1 at 3:39
when i runvagrant destroy app9,up app9,ssh app9
it outputs as if i ranvagrant
command only without any parameters
â MaverickD
Oct 1 at 3:41
1
So you need to run those as separate commands, and brace expansion won't help much with that. See dupe^
â muru
Oct 1 at 3:43
1
1
Does
vagrant destroy app9 up app9 ssh app9
or vagrant destroy up ssh app9
work?â muru
Oct 1 at 3:34
Does
vagrant destroy app9 up app9 ssh app9
or vagrant destroy up ssh app9
work?â muru
Oct 1 at 3:34
no it doesn't but
vagrant destroy app9 && vagrant up app9 && vagrant ssh app9
does.â MaverickD
Oct 1 at 3:39
no it doesn't but
vagrant destroy app9 && vagrant up app9 && vagrant ssh app9
does.â MaverickD
Oct 1 at 3:39
when i run
vagrant destroy app9,up app9,ssh app9
it outputs as if i ran vagrant
command only without any parametersâ MaverickD
Oct 1 at 3:41
when i run
vagrant destroy app9,up app9,ssh app9
it outputs as if i ran vagrant
command only without any parametersâ MaverickD
Oct 1 at 3:41
1
1
So you need to run those as separate commands, and brace expansion won't help much with that. See dupe^
â muru
Oct 1 at 3:43
So you need to run those as separate commands, and brace expansion won't help much with that. See dupe^
â muru
Oct 1 at 3:43
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
In none of the cases where you use curly braces in your question are you running multiple commands.
touch 1..10.txt
runs one command on 10 files:
touch 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt 10.txt
The command
systemctl restart app9-server,client,test
is still just one command:
systemctl restart app9-server app9-client app9-test
Brace expansion is used to perform a simple text expansion of one or several strings in a single command.
The three tasks you want to perform must be three separate commands. You may do this in a loop if you wish:
for cmd in destroy up ssh; do
vagrant "$cmd" app9
done
add a comment |Â
up vote
0
down vote
Try:
eval 'vagrant 'destroy,up,ssh' app9;'
Notice the quotes.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
In none of the cases where you use curly braces in your question are you running multiple commands.
touch 1..10.txt
runs one command on 10 files:
touch 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt 10.txt
The command
systemctl restart app9-server,client,test
is still just one command:
systemctl restart app9-server app9-client app9-test
Brace expansion is used to perform a simple text expansion of one or several strings in a single command.
The three tasks you want to perform must be three separate commands. You may do this in a loop if you wish:
for cmd in destroy up ssh; do
vagrant "$cmd" app9
done
add a comment |Â
up vote
1
down vote
accepted
In none of the cases where you use curly braces in your question are you running multiple commands.
touch 1..10.txt
runs one command on 10 files:
touch 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt 10.txt
The command
systemctl restart app9-server,client,test
is still just one command:
systemctl restart app9-server app9-client app9-test
Brace expansion is used to perform a simple text expansion of one or several strings in a single command.
The three tasks you want to perform must be three separate commands. You may do this in a loop if you wish:
for cmd in destroy up ssh; do
vagrant "$cmd" app9
done
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
In none of the cases where you use curly braces in your question are you running multiple commands.
touch 1..10.txt
runs one command on 10 files:
touch 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt 10.txt
The command
systemctl restart app9-server,client,test
is still just one command:
systemctl restart app9-server app9-client app9-test
Brace expansion is used to perform a simple text expansion of one or several strings in a single command.
The three tasks you want to perform must be three separate commands. You may do this in a loop if you wish:
for cmd in destroy up ssh; do
vagrant "$cmd" app9
done
In none of the cases where you use curly braces in your question are you running multiple commands.
touch 1..10.txt
runs one command on 10 files:
touch 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt 10.txt
The command
systemctl restart app9-server,client,test
is still just one command:
systemctl restart app9-server app9-client app9-test
Brace expansion is used to perform a simple text expansion of one or several strings in a single command.
The three tasks you want to perform must be three separate commands. You may do this in a loop if you wish:
for cmd in destroy up ssh; do
vagrant "$cmd" app9
done
answered Oct 1 at 5:37
Kusalananda
108k14210333
108k14210333
add a comment |Â
add a comment |Â
up vote
0
down vote
Try:
eval 'vagrant 'destroy,up,ssh' app9;'
Notice the quotes.
add a comment |Â
up vote
0
down vote
Try:
eval 'vagrant 'destroy,up,ssh' app9;'
Notice the quotes.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Try:
eval 'vagrant 'destroy,up,ssh' app9;'
Notice the quotes.
Try:
eval 'vagrant 'destroy,up,ssh' app9;'
Notice the quotes.
answered Oct 1 at 3:40
mosvy
1,837110
1,837110
add a comment |Â
add a comment |Â
1
Does
vagrant destroy app9 up app9 ssh app9
orvagrant destroy up ssh app9
work?â muru
Oct 1 at 3:34
no it doesn't but
vagrant destroy app9 && vagrant up app9 && vagrant ssh app9
does.â MaverickD
Oct 1 at 3:39
when i run
vagrant destroy app9,up app9,ssh app9
it outputs as if i ranvagrant
command only without any parametersâ MaverickD
Oct 1 at 3:41
1
So you need to run those as separate commands, and brace expansion won't help much with that. See dupe^
â muru
Oct 1 at 3:43