How to make this bash command not allow the empty string in a “string substitution” [this,that]*?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












Consider the command:



scp my-machine:/home/user/a-folder/[massif,callgrind]* .



Where my intent is to copy only the files from my-machine:/home/user/a-folder/ that start with massif or callgrind keywords. As of right now, the substitution of [massif,callgrind] is also considering the empty string, thus copying any file in the folder because of the *.



What do I have to change to make it work correctly?









share







New contributor




nico is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    0
    down vote

    favorite












    Consider the command:



    scp my-machine:/home/user/a-folder/[massif,callgrind]* .



    Where my intent is to copy only the files from my-machine:/home/user/a-folder/ that start with massif or callgrind keywords. As of right now, the substitution of [massif,callgrind] is also considering the empty string, thus copying any file in the folder because of the *.



    What do I have to change to make it work correctly?









    share







    New contributor




    nico is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Consider the command:



      scp my-machine:/home/user/a-folder/[massif,callgrind]* .



      Where my intent is to copy only the files from my-machine:/home/user/a-folder/ that start with massif or callgrind keywords. As of right now, the substitution of [massif,callgrind] is also considering the empty string, thus copying any file in the folder because of the *.



      What do I have to change to make it work correctly?









      share







      New contributor




      nico is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Consider the command:



      scp my-machine:/home/user/a-folder/[massif,callgrind]* .



      Where my intent is to copy only the files from my-machine:/home/user/a-folder/ that start with massif or callgrind keywords. As of right now, the substitution of [massif,callgrind] is also considering the empty string, thus copying any file in the folder because of the *.



      What do I have to change to make it work correctly?







      bash shell-script





      share







      New contributor




      nico is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      nico is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      nico is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 5 mins ago









      nico

      11




      11




      New contributor




      nico is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      nico is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      nico is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          It sounds like you want curly-brackets there:



          scp my-machine:/home/user/a-folder/massif,callgrind* .


          Otherwise you're matching on single characters, rather than the two complete strings.





          share








          New contributor




          Jeremy Kerr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
            – nico
            1 min ago










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          nico is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f477664%2fhow-to-make-this-bash-command-not-allow-the-empty-string-in-a-string-substituti%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          It sounds like you want curly-brackets there:



          scp my-machine:/home/user/a-folder/massif,callgrind* .


          Otherwise you're matching on single characters, rather than the two complete strings.





          share








          New contributor




          Jeremy Kerr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
            – nico
            1 min ago














          up vote
          0
          down vote













          It sounds like you want curly-brackets there:



          scp my-machine:/home/user/a-folder/massif,callgrind* .


          Otherwise you're matching on single characters, rather than the two complete strings.





          share








          New contributor




          Jeremy Kerr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
            – nico
            1 min ago












          up vote
          0
          down vote










          up vote
          0
          down vote









          It sounds like you want curly-brackets there:



          scp my-machine:/home/user/a-folder/massif,callgrind* .


          Otherwise you're matching on single characters, rather than the two complete strings.





          share








          New contributor




          Jeremy Kerr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          It sounds like you want curly-brackets there:



          scp my-machine:/home/user/a-folder/massif,callgrind* .


          Otherwise you're matching on single characters, rather than the two complete strings.






          share








          New contributor




          Jeremy Kerr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.








          share


          share






          New contributor




          Jeremy Kerr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered 3 mins ago









          Jeremy Kerr

          1054




          1054




          New contributor




          Jeremy Kerr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          Jeremy Kerr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          Jeremy Kerr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.











          • Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
            – nico
            1 min ago
















          • Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
            – nico
            1 min ago















          Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
          – nico
          1 min ago




          Aha! That is it. In fact it was accepting anything that would start with these letters plus the comma. Thank you!
          – nico
          1 min ago










          nico is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          nico is a new contributor. Be nice, and check out our Code of Conduct.












          nico is a new contributor. Be nice, and check out our Code of Conduct.











          nico is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f477664%2fhow-to-make-this-bash-command-not-allow-the-empty-string-in-a-string-substituti%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

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

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?