using curly braces to run multiple commands that have spaces [duplicate]

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash 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?










share|improve this 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




    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










  • 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




    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














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?










share|improve this 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




    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










  • 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




    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












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?










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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




    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










  • 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




    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




    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










  • 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




    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










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





share|improve this answer



























    up vote
    0
    down vote













    Try:



    eval 'vagrant 'destroy,up,ssh' app9;'


    Notice the quotes.






    share|improve this answer



























      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





      share|improve this answer
























        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





        share|improve this answer






















          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





          share|improve this answer












          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






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 1 at 5:37









          Kusalananda

          108k14210333




          108k14210333






















              up vote
              0
              down vote













              Try:



              eval 'vagrant 'destroy,up,ssh' app9;'


              Notice the quotes.






              share|improve this answer
























                up vote
                0
                down vote













                Try:



                eval 'vagrant 'destroy,up,ssh' app9;'


                Notice the quotes.






                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Try:



                  eval 'vagrant 'destroy,up,ssh' app9;'


                  Notice the quotes.






                  share|improve this answer












                  Try:



                  eval 'vagrant 'destroy,up,ssh' app9;'


                  Notice the quotes.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 1 at 3:40









                  mosvy

                  1,837110




                  1,837110












                      Hqjw,A,w2of43aFCfTtQ opGFjrc,BbE8,0HuaRdSBeKzG1f
                      ZMN5wH8rl ZlkgFMaCmNqdwb0lY,MOEjJKM4lRKFcrVk lK,DpQQ BCluqi4MOKcQ9g nveX57G85FIfnPQBs,Ko,z5,wN

                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      How many registers does an x86_64 CPU actually have?

                      Displaying single band from multi-band raster using QGIS