How to store a filename currently *.jpg reading in command rm *.jpg? [closed]

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








up vote
-1
down vote

favorite












I want to use the filename currently used by *. How to get the name of the file?










share|improve this question















closed as unclear what you're asking by Yaron, Arronical, dessert, vidarlo, Eric Carvalho Feb 14 at 13:53


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 2




    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
    – Yaron
    Feb 14 at 9:14














up vote
-1
down vote

favorite












I want to use the filename currently used by *. How to get the name of the file?










share|improve this question















closed as unclear what you're asking by Yaron, Arronical, dessert, vidarlo, Eric Carvalho Feb 14 at 13:53


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 2




    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
    – Yaron
    Feb 14 at 9:14












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I want to use the filename currently used by *. How to get the name of the file?










share|improve this question















I want to use the filename currently used by *. How to get the name of the file?







command-line gnome-terminal wildcards






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 14 at 9:23









Arronical

12.7k84589




12.7k84589










asked Feb 14 at 9:11









DENSETSU

1




1




closed as unclear what you're asking by Yaron, Arronical, dessert, vidarlo, Eric Carvalho Feb 14 at 13:53


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Yaron, Arronical, dessert, vidarlo, Eric Carvalho Feb 14 at 13:53


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 2




    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
    – Yaron
    Feb 14 at 9:14












  • 2




    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
    – Yaron
    Feb 14 at 9:14







2




2




Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
– Yaron
Feb 14 at 9:14




Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.
– Yaron
Feb 14 at 9:14










3 Answers
3






active

oldest

votes

















up vote
1
down vote















If you want to use the star char * usually used as a wildcard in bash to select multiple files, you need to quote the filename or escape the * with a backslash . Example:



$ touch '*.jpg'
$ touch 'mypicture.jpg'
$ ls
'*.jpg' mypicture.jpg
$ rm '*.jpg'
$ ls
mypicture.jpg


You can also use the same script with *.jpg instead of '*.jpg'.






share|improve this answer






















  • We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
    – Arronical
    Feb 14 at 9:23










  • @Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
    – tobiasBora
    Feb 14 at 9:37

















up vote
0
down vote















*.jpg will expand to every .jpg file in the current directory. If you execute rm *.jpg, all of those files will be deleted. The shell expansion of the wildcard * does not store the results as separate variables, or give you a way to reference individual results within the expansion set.



If you wish to operate on each file matched by the wildcard expression, you may wish to use a for loop. Using a loop can assign the filename to a variable that you choose on each run of the loop. For example:



for file in *.jpg; do
echo "$file"
done


Will echo each of the files matched by *.jpg. You can of course use much more complex commands inside the loop, including other conditional statements such as if statements.






share|improve this answer





























    up vote
    0
    down vote













    To show all the files indicated by *.jpg type:



    ls *.jpg


    The command rm *.jpg will remove all of these files.






    share|improve this answer



























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote















      If you want to use the star char * usually used as a wildcard in bash to select multiple files, you need to quote the filename or escape the * with a backslash . Example:



      $ touch '*.jpg'
      $ touch 'mypicture.jpg'
      $ ls
      '*.jpg' mypicture.jpg
      $ rm '*.jpg'
      $ ls
      mypicture.jpg


      You can also use the same script with *.jpg instead of '*.jpg'.






      share|improve this answer






















      • We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
        – Arronical
        Feb 14 at 9:23










      • @Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
        – tobiasBora
        Feb 14 at 9:37














      up vote
      1
      down vote















      If you want to use the star char * usually used as a wildcard in bash to select multiple files, you need to quote the filename or escape the * with a backslash . Example:



      $ touch '*.jpg'
      $ touch 'mypicture.jpg'
      $ ls
      '*.jpg' mypicture.jpg
      $ rm '*.jpg'
      $ ls
      mypicture.jpg


      You can also use the same script with *.jpg instead of '*.jpg'.






      share|improve this answer






















      • We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
        – Arronical
        Feb 14 at 9:23










      • @Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
        – tobiasBora
        Feb 14 at 9:37












      up vote
      1
      down vote










      up vote
      1
      down vote











      If you want to use the star char * usually used as a wildcard in bash to select multiple files, you need to quote the filename or escape the * with a backslash . Example:



      $ touch '*.jpg'
      $ touch 'mypicture.jpg'
      $ ls
      '*.jpg' mypicture.jpg
      $ rm '*.jpg'
      $ ls
      mypicture.jpg


      You can also use the same script with *.jpg instead of '*.jpg'.






      share|improve this answer
















      If you want to use the star char * usually used as a wildcard in bash to select multiple files, you need to quote the filename or escape the * with a backslash . Example:



      $ touch '*.jpg'
      $ touch 'mypicture.jpg'
      $ ls
      '*.jpg' mypicture.jpg
      $ rm '*.jpg'
      $ ls
      mypicture.jpg


      You can also use the same script with *.jpg instead of '*.jpg'.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Feb 14 at 9:58









      dessert

      20k55795




      20k55795










      answered Feb 14 at 9:20









      tobiasBora

      86469




      86469











      • We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
        – Arronical
        Feb 14 at 9:23










      • @Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
        – tobiasBora
        Feb 14 at 9:37
















      • We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
        – Arronical
        Feb 14 at 9:23










      • @Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
        – tobiasBora
        Feb 14 at 9:37















      We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
      – Arronical
      Feb 14 at 9:23




      We've both answered from different viewpoints of what the OP has asked, as the question's a bit unclear. I think your view might actually be closer to what the OP is asking for.
      – Arronical
      Feb 14 at 9:23












      @Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
      – tobiasBora
      Feb 14 at 9:37




      @Arronical I've no idea, the question is pretty unclear actually, let's wait and see ;-)
      – tobiasBora
      Feb 14 at 9:37












      up vote
      0
      down vote















      *.jpg will expand to every .jpg file in the current directory. If you execute rm *.jpg, all of those files will be deleted. The shell expansion of the wildcard * does not store the results as separate variables, or give you a way to reference individual results within the expansion set.



      If you wish to operate on each file matched by the wildcard expression, you may wish to use a for loop. Using a loop can assign the filename to a variable that you choose on each run of the loop. For example:



      for file in *.jpg; do
      echo "$file"
      done


      Will echo each of the files matched by *.jpg. You can of course use much more complex commands inside the loop, including other conditional statements such as if statements.






      share|improve this answer


























        up vote
        0
        down vote















        *.jpg will expand to every .jpg file in the current directory. If you execute rm *.jpg, all of those files will be deleted. The shell expansion of the wildcard * does not store the results as separate variables, or give you a way to reference individual results within the expansion set.



        If you wish to operate on each file matched by the wildcard expression, you may wish to use a for loop. Using a loop can assign the filename to a variable that you choose on each run of the loop. For example:



        for file in *.jpg; do
        echo "$file"
        done


        Will echo each of the files matched by *.jpg. You can of course use much more complex commands inside the loop, including other conditional statements such as if statements.






        share|improve this answer
























          up vote
          0
          down vote










          up vote
          0
          down vote











          *.jpg will expand to every .jpg file in the current directory. If you execute rm *.jpg, all of those files will be deleted. The shell expansion of the wildcard * does not store the results as separate variables, or give you a way to reference individual results within the expansion set.



          If you wish to operate on each file matched by the wildcard expression, you may wish to use a for loop. Using a loop can assign the filename to a variable that you choose on each run of the loop. For example:



          for file in *.jpg; do
          echo "$file"
          done


          Will echo each of the files matched by *.jpg. You can of course use much more complex commands inside the loop, including other conditional statements such as if statements.






          share|improve this answer
















          *.jpg will expand to every .jpg file in the current directory. If you execute rm *.jpg, all of those files will be deleted. The shell expansion of the wildcard * does not store the results as separate variables, or give you a way to reference individual results within the expansion set.



          If you wish to operate on each file matched by the wildcard expression, you may wish to use a for loop. Using a loop can assign the filename to a variable that you choose on each run of the loop. For example:



          for file in *.jpg; do
          echo "$file"
          done


          Will echo each of the files matched by *.jpg. You can of course use much more complex commands inside the loop, including other conditional statements such as if statements.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 14 at 9:59









          dessert

          20k55795




          20k55795










          answered Feb 14 at 9:21









          Arronical

          12.7k84589




          12.7k84589




















              up vote
              0
              down vote













              To show all the files indicated by *.jpg type:



              ls *.jpg


              The command rm *.jpg will remove all of these files.






              share|improve this answer
























                up vote
                0
                down vote













                To show all the files indicated by *.jpg type:



                ls *.jpg


                The command rm *.jpg will remove all of these files.






                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  To show all the files indicated by *.jpg type:



                  ls *.jpg


                  The command rm *.jpg will remove all of these files.






                  share|improve this answer












                  To show all the files indicated by *.jpg type:



                  ls *.jpg


                  The command rm *.jpg will remove all of these files.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 14 at 11:11









                  karel

                  51.6k11107131




                  51.6k11107131












                      Popular posts from this blog

                      pylint3 and pip3 broken

                      Missing snmpget and snmpwalk

                      How to enroll fingerprints to Ubuntu 17.10 with VFS491