* at end of directory path

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












6















I have a question about the * character at the end of a directory path in a bash script.



I have a script that's supposed to automatically delete some archives from a server once they get old enough. The script is on machine A and I need to run it on machine B. I access both machines remotely through ssh (no sudo, just regular user). One of the rules of the script is that it needs to only delete archives in the folders beginning with dirA/dirB/dirC/dirD/dirE*.



However, there is no dirE in that location so I'm guessing the * stands for some variable. This is what I'd like to know, what does the * mean at the end of the directory path and what does it make the script do?










share|improve this question




























    6















    I have a question about the * character at the end of a directory path in a bash script.



    I have a script that's supposed to automatically delete some archives from a server once they get old enough. The script is on machine A and I need to run it on machine B. I access both machines remotely through ssh (no sudo, just regular user). One of the rules of the script is that it needs to only delete archives in the folders beginning with dirA/dirB/dirC/dirD/dirE*.



    However, there is no dirE in that location so I'm guessing the * stands for some variable. This is what I'd like to know, what does the * mean at the end of the directory path and what does it make the script do?










    share|improve this question


























      6












      6








      6








      I have a question about the * character at the end of a directory path in a bash script.



      I have a script that's supposed to automatically delete some archives from a server once they get old enough. The script is on machine A and I need to run it on machine B. I access both machines remotely through ssh (no sudo, just regular user). One of the rules of the script is that it needs to only delete archives in the folders beginning with dirA/dirB/dirC/dirD/dirE*.



      However, there is no dirE in that location so I'm guessing the * stands for some variable. This is what I'd like to know, what does the * mean at the end of the directory path and what does it make the script do?










      share|improve this question
















      I have a question about the * character at the end of a directory path in a bash script.



      I have a script that's supposed to automatically delete some archives from a server once they get old enough. The script is on machine A and I need to run it on machine B. I access both machines remotely through ssh (no sudo, just regular user). One of the rules of the script is that it needs to only delete archives in the folders beginning with dirA/dirB/dirC/dirD/dirE*.



      However, there is no dirE in that location so I'm guessing the * stands for some variable. This is what I'd like to know, what does the * mean at the end of the directory path and what does it make the script do?







      bash scripting directory path






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 13 at 21:44









      Rui F Ribeiro

      39.7k1479132




      39.7k1479132










      asked Oct 18 '16 at 7:24









      kabraskabras

      342




      342




















          2 Answers
          2






          active

          oldest

          votes


















          9














          The * here is a "globbing character" and means "match 0 or more characters". To illustrate, consider this directory:



          $ ls
          dirA dire dirE dirEa dirEEE
          $ echo dirE*
          dirE dirEa dirEEE


          As you can see above, the glob dirE* matches dirE, dirEa and dirEEE but not dirA or dire (*nix systems are case sensitive).



          So, in your script, that means it will delete archives from any directory in dirA/dirB/dirC/dirD/ whose name begins with dirE.






          share|improve this answer























          • hey, not sure if i need to make another thread but i have another question on the same script i thought i'd ask here. so that script that's on machine A has the location of the archives that need to be checked defined as "dirA/dirB/dirC/dirD". However, i need to run the script on machine B with the dirE* condition as well. I suppose i need to edit the script to add this dirE* condition. i

            – kabras
            Oct 18 '16 at 8:20






          • 4





            @kabras yes, please ask a new question. If you need help in editing a script, make sure you include the script in the question. I also suggest you read a simple shell scripting tutorial first to get at least a basic idea of how the language works.

            – terdon
            Oct 18 '16 at 8:25


















          6














          I'll just add a note here for those that come to this Q&A for another reason.



          If you see a * at the end of a filename in the output of ls (actually of ls -F, but ls is sometimes aliased to ls -F (or the ls-F builtin in tcsh), or of zsh or tcsh completions, that's something completely different.



          With the -F option, ls adds a trailing character at the end of some special file name to help identify their specialness. zsh and tcsh do the same when listing file name completions.



          If you see:



          $ ls -F
          dir/ fifo| file link@ ls* socket=


          Those /, |, * and = are not part of the file name (though they might be if someone tried to trick you), but are appended by ls to tell you that:




          • dir is a directory (/)


          • fifo is a named pipe/fifo (|)


          • link is a symbolic link (@)


          • ls is an executable regular file (*) (has at least one execution bit in its permissions)


          • socket is a Unix domain socket (=)

          Some ls implementations (and zsh's completion) can also do that differentiation via colours for terminals that support them with different options.






          share|improve this answer
























            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',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f317121%2fat-end-of-directory-path%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            9














            The * here is a "globbing character" and means "match 0 or more characters". To illustrate, consider this directory:



            $ ls
            dirA dire dirE dirEa dirEEE
            $ echo dirE*
            dirE dirEa dirEEE


            As you can see above, the glob dirE* matches dirE, dirEa and dirEEE but not dirA or dire (*nix systems are case sensitive).



            So, in your script, that means it will delete archives from any directory in dirA/dirB/dirC/dirD/ whose name begins with dirE.






            share|improve this answer























            • hey, not sure if i need to make another thread but i have another question on the same script i thought i'd ask here. so that script that's on machine A has the location of the archives that need to be checked defined as "dirA/dirB/dirC/dirD". However, i need to run the script on machine B with the dirE* condition as well. I suppose i need to edit the script to add this dirE* condition. i

              – kabras
              Oct 18 '16 at 8:20






            • 4





              @kabras yes, please ask a new question. If you need help in editing a script, make sure you include the script in the question. I also suggest you read a simple shell scripting tutorial first to get at least a basic idea of how the language works.

              – terdon
              Oct 18 '16 at 8:25















            9














            The * here is a "globbing character" and means "match 0 or more characters". To illustrate, consider this directory:



            $ ls
            dirA dire dirE dirEa dirEEE
            $ echo dirE*
            dirE dirEa dirEEE


            As you can see above, the glob dirE* matches dirE, dirEa and dirEEE but not dirA or dire (*nix systems are case sensitive).



            So, in your script, that means it will delete archives from any directory in dirA/dirB/dirC/dirD/ whose name begins with dirE.






            share|improve this answer























            • hey, not sure if i need to make another thread but i have another question on the same script i thought i'd ask here. so that script that's on machine A has the location of the archives that need to be checked defined as "dirA/dirB/dirC/dirD". However, i need to run the script on machine B with the dirE* condition as well. I suppose i need to edit the script to add this dirE* condition. i

              – kabras
              Oct 18 '16 at 8:20






            • 4





              @kabras yes, please ask a new question. If you need help in editing a script, make sure you include the script in the question. I also suggest you read a simple shell scripting tutorial first to get at least a basic idea of how the language works.

              – terdon
              Oct 18 '16 at 8:25













            9












            9








            9







            The * here is a "globbing character" and means "match 0 or more characters". To illustrate, consider this directory:



            $ ls
            dirA dire dirE dirEa dirEEE
            $ echo dirE*
            dirE dirEa dirEEE


            As you can see above, the glob dirE* matches dirE, dirEa and dirEEE but not dirA or dire (*nix systems are case sensitive).



            So, in your script, that means it will delete archives from any directory in dirA/dirB/dirC/dirD/ whose name begins with dirE.






            share|improve this answer













            The * here is a "globbing character" and means "match 0 or more characters". To illustrate, consider this directory:



            $ ls
            dirA dire dirE dirEa dirEEE
            $ echo dirE*
            dirE dirEa dirEEE


            As you can see above, the glob dirE* matches dirE, dirEa and dirEEE but not dirA or dire (*nix systems are case sensitive).



            So, in your script, that means it will delete archives from any directory in dirA/dirB/dirC/dirD/ whose name begins with dirE.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 18 '16 at 7:35









            terdonterdon

            130k32254432




            130k32254432












            • hey, not sure if i need to make another thread but i have another question on the same script i thought i'd ask here. so that script that's on machine A has the location of the archives that need to be checked defined as "dirA/dirB/dirC/dirD". However, i need to run the script on machine B with the dirE* condition as well. I suppose i need to edit the script to add this dirE* condition. i

              – kabras
              Oct 18 '16 at 8:20






            • 4





              @kabras yes, please ask a new question. If you need help in editing a script, make sure you include the script in the question. I also suggest you read a simple shell scripting tutorial first to get at least a basic idea of how the language works.

              – terdon
              Oct 18 '16 at 8:25

















            • hey, not sure if i need to make another thread but i have another question on the same script i thought i'd ask here. so that script that's on machine A has the location of the archives that need to be checked defined as "dirA/dirB/dirC/dirD". However, i need to run the script on machine B with the dirE* condition as well. I suppose i need to edit the script to add this dirE* condition. i

              – kabras
              Oct 18 '16 at 8:20






            • 4





              @kabras yes, please ask a new question. If you need help in editing a script, make sure you include the script in the question. I also suggest you read a simple shell scripting tutorial first to get at least a basic idea of how the language works.

              – terdon
              Oct 18 '16 at 8:25
















            hey, not sure if i need to make another thread but i have another question on the same script i thought i'd ask here. so that script that's on machine A has the location of the archives that need to be checked defined as "dirA/dirB/dirC/dirD". However, i need to run the script on machine B with the dirE* condition as well. I suppose i need to edit the script to add this dirE* condition. i

            – kabras
            Oct 18 '16 at 8:20





            hey, not sure if i need to make another thread but i have another question on the same script i thought i'd ask here. so that script that's on machine A has the location of the archives that need to be checked defined as "dirA/dirB/dirC/dirD". However, i need to run the script on machine B with the dirE* condition as well. I suppose i need to edit the script to add this dirE* condition. i

            – kabras
            Oct 18 '16 at 8:20




            4




            4





            @kabras yes, please ask a new question. If you need help in editing a script, make sure you include the script in the question. I also suggest you read a simple shell scripting tutorial first to get at least a basic idea of how the language works.

            – terdon
            Oct 18 '16 at 8:25





            @kabras yes, please ask a new question. If you need help in editing a script, make sure you include the script in the question. I also suggest you read a simple shell scripting tutorial first to get at least a basic idea of how the language works.

            – terdon
            Oct 18 '16 at 8:25













            6














            I'll just add a note here for those that come to this Q&A for another reason.



            If you see a * at the end of a filename in the output of ls (actually of ls -F, but ls is sometimes aliased to ls -F (or the ls-F builtin in tcsh), or of zsh or tcsh completions, that's something completely different.



            With the -F option, ls adds a trailing character at the end of some special file name to help identify their specialness. zsh and tcsh do the same when listing file name completions.



            If you see:



            $ ls -F
            dir/ fifo| file link@ ls* socket=


            Those /, |, * and = are not part of the file name (though they might be if someone tried to trick you), but are appended by ls to tell you that:




            • dir is a directory (/)


            • fifo is a named pipe/fifo (|)


            • link is a symbolic link (@)


            • ls is an executable regular file (*) (has at least one execution bit in its permissions)


            • socket is a Unix domain socket (=)

            Some ls implementations (and zsh's completion) can also do that differentiation via colours for terminals that support them with different options.






            share|improve this answer





























              6














              I'll just add a note here for those that come to this Q&A for another reason.



              If you see a * at the end of a filename in the output of ls (actually of ls -F, but ls is sometimes aliased to ls -F (or the ls-F builtin in tcsh), or of zsh or tcsh completions, that's something completely different.



              With the -F option, ls adds a trailing character at the end of some special file name to help identify their specialness. zsh and tcsh do the same when listing file name completions.



              If you see:



              $ ls -F
              dir/ fifo| file link@ ls* socket=


              Those /, |, * and = are not part of the file name (though they might be if someone tried to trick you), but are appended by ls to tell you that:




              • dir is a directory (/)


              • fifo is a named pipe/fifo (|)


              • link is a symbolic link (@)


              • ls is an executable regular file (*) (has at least one execution bit in its permissions)


              • socket is a Unix domain socket (=)

              Some ls implementations (and zsh's completion) can also do that differentiation via colours for terminals that support them with different options.






              share|improve this answer



























                6












                6








                6







                I'll just add a note here for those that come to this Q&A for another reason.



                If you see a * at the end of a filename in the output of ls (actually of ls -F, but ls is sometimes aliased to ls -F (or the ls-F builtin in tcsh), or of zsh or tcsh completions, that's something completely different.



                With the -F option, ls adds a trailing character at the end of some special file name to help identify their specialness. zsh and tcsh do the same when listing file name completions.



                If you see:



                $ ls -F
                dir/ fifo| file link@ ls* socket=


                Those /, |, * and = are not part of the file name (though they might be if someone tried to trick you), but are appended by ls to tell you that:




                • dir is a directory (/)


                • fifo is a named pipe/fifo (|)


                • link is a symbolic link (@)


                • ls is an executable regular file (*) (has at least one execution bit in its permissions)


                • socket is a Unix domain socket (=)

                Some ls implementations (and zsh's completion) can also do that differentiation via colours for terminals that support them with different options.






                share|improve this answer















                I'll just add a note here for those that come to this Q&A for another reason.



                If you see a * at the end of a filename in the output of ls (actually of ls -F, but ls is sometimes aliased to ls -F (or the ls-F builtin in tcsh), or of zsh or tcsh completions, that's something completely different.



                With the -F option, ls adds a trailing character at the end of some special file name to help identify their specialness. zsh and tcsh do the same when listing file name completions.



                If you see:



                $ ls -F
                dir/ fifo| file link@ ls* socket=


                Those /, |, * and = are not part of the file name (though they might be if someone tried to trick you), but are appended by ls to tell you that:




                • dir is a directory (/)


                • fifo is a named pipe/fifo (|)


                • link is a symbolic link (@)


                • ls is an executable regular file (*) (has at least one execution bit in its permissions)


                • socket is a Unix domain socket (=)

                Some ls implementations (and zsh's completion) can also do that differentiation via colours for terminals that support them with different options.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Oct 18 '16 at 10:34

























                answered Oct 18 '16 at 9:01









                Stéphane ChazelasStéphane Chazelas

                303k56570926




                303k56570926



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f317121%2fat-end-of-directory-path%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown






                    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?