Using globbing/wildcards when Opening Files from Terminal The Next CEO of Stack OverflowMerging folders with practically the same name but different casingHow to use rsync or scp to efficiently copy the files from machineB and machineC to machineA?Assigning files key words to easily find them laterRecursively remove files with idx > 10,000Folder organizationextract subfolders outside and rename if necessaryHow to include hidden files in stat command?Copying and pasting specific file types in folders and subfoldersIs there a best practice to store persistent data for a shell script?How do I open files with flatpak okular from command line?

How can I prove that a state of equilibrium is unstable?

Creating a script with console commands

Mathematica command that allows it to read my intentions

Is the offspring between a demon and a celestial possible? If so what is it called and is it in a book somewhere?

Man transported from Alternate World into ours by a Neutrino Detector

What steps are necessary to read a Modern SSD in Medieval Europe?

Is there a rule of thumb for determining the amount one should accept for a settlement offer?

Why did the Drakh emissary look so blurred in S04:E11 "Lines of Communication"?

That's an odd coin - I wonder why

Is it reasonable to ask other researchers to send me their previous grant applications?

Can I cast Thunderwave and be at the center of its bottom face, but not be affected by it?

Calculating discount not working

Car headlights in a world without electricity

How does a dynamic QR code work?

logical reads on global temp table, but not on session-level temp table

How should I connect my cat5 cable to connectors having an orange-green line?

Calculate the Mean mean of two numbers

Why did early computer designers eschew integers?

Is this a new Fibonacci Identity?

Why do we say “un seul M” and not “une seule M” even though M is a “consonne”?

How do I secure a TV wall mount?

Is it a bad idea to plug the other end of ESD strap to wall ground?

Read/write a pipe-delimited file line by line with some simple text manipulation

Ising model simulation



Using globbing/wildcards when Opening Files from Terminal



The Next CEO of Stack OverflowMerging folders with practically the same name but different casingHow to use rsync or scp to efficiently copy the files from machineB and machineC to machineA?Assigning files key words to easily find them laterRecursively remove files with idx > 10,000Folder organizationextract subfolders outside and rename if necessaryHow to include hidden files in stat command?Copying and pasting specific file types in folders and subfoldersIs there a best practice to store persistent data for a shell script?How do I open files with flatpak okular from command line?










1















I have a folder A. Inside the folder, there are some files a,b,c,d and there is a subfolder, B, containing files e,f,g.



Suppose I want to open files a,b,c,d: then I just type xdg-open *. However, this also goes into subfolder B and opens e,f,g as well. What's the easiest way to open just a,b,c,d?



EDIT: what I really mean with the question is how to open all files in a folder, but not those contained in any subfolders.










share|improve this question
























  • See my updated answer, extended globbing is what you're looking for.

    – slm
    Nov 16 '13 at 1:29















1















I have a folder A. Inside the folder, there are some files a,b,c,d and there is a subfolder, B, containing files e,f,g.



Suppose I want to open files a,b,c,d: then I just type xdg-open *. However, this also goes into subfolder B and opens e,f,g as well. What's the easiest way to open just a,b,c,d?



EDIT: what I really mean with the question is how to open all files in a folder, but not those contained in any subfolders.










share|improve this question
























  • See my updated answer, extended globbing is what you're looking for.

    – slm
    Nov 16 '13 at 1:29













1












1








1


1






I have a folder A. Inside the folder, there are some files a,b,c,d and there is a subfolder, B, containing files e,f,g.



Suppose I want to open files a,b,c,d: then I just type xdg-open *. However, this also goes into subfolder B and opens e,f,g as well. What's the easiest way to open just a,b,c,d?



EDIT: what I really mean with the question is how to open all files in a folder, but not those contained in any subfolders.










share|improve this question
















I have a folder A. Inside the folder, there are some files a,b,c,d and there is a subfolder, B, containing files e,f,g.



Suppose I want to open files a,b,c,d: then I just type xdg-open *. However, this also goes into subfolder B and opens e,f,g as well. What's the easiest way to open just a,b,c,d?



EDIT: what I really mean with the question is how to open all files in a folder, but not those contained in any subfolders.







bash shell command-line terminal command






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '13 at 16:20









jmc

233212




233212










asked Nov 15 '13 at 21:41









NewbNewb

4171715




4171715












  • See my updated answer, extended globbing is what you're looking for.

    – slm
    Nov 16 '13 at 1:29

















  • See my updated answer, extended globbing is what you're looking for.

    – slm
    Nov 16 '13 at 1:29
















See my updated answer, extended globbing is what you're looking for.

– slm
Nov 16 '13 at 1:29





See my updated answer, extended globbing is what you're looking for.

– slm
Nov 16 '13 at 1:29










3 Answers
3






active

oldest

votes


















3














How about find A -maxdepth 1 -type f -exec xdg-open ;



That should open all files in folder A without going any further than the top level.






share|improve this answer























  • That'll work, but it's a pretty long command. I could alias it, but I feel as if a more elegant solution has to be possible...

    – Newb
    Nov 15 '13 at 22:41











  • As far as I'm aware that's the closest your gonna get to what you need.

    – Jeight
    Nov 15 '13 at 23:03











  • This seems like the best option.

    – coteyr
    Nov 16 '13 at 0:58











  • @coteyr - You can do better than this using extended globbing in Bash! See my updated answer.

    – slm
    Nov 16 '13 at 1:28












  • @slm, I think the globbing is nice but it seems to be "harder" to use unless you want to "know" the folders content. This answer can just be run with out any special knowledge of the directory.

    – coteyr
    Nov 16 '13 at 4:59


















1














Method #1 - Shell expansions



If you know that the items you're after are sequentially named you can use shell expansions in a variety of ways.



Examples



$ xdg-open [a-d]
$ xdg-open a..d
$ xdg-open a* b*


Method #2 - Extended globbing



In Bash (versions 3.2+) you can use extended globbing to included everything except something, which I believe is what you're asking for.



Examples



$ xdg-open !(B)
$ xdg-open !(A|B)


Demos



I'll often times use echo so I can see what the globstar or extended globbing will work out to be without actually running a real command on the expanded lists of files and/or directories.



Example



Say for example I have the following directory of files.



$ ls -l
total 8
-rw-rw-r-- 1 saml saml 0 Nov 15 20:12 a
drwxrwxr-x 2 saml saml 4096 Nov 15 20:23 A
-rw-rw-r-- 1 saml saml 0 Nov 15 20:12 b
drwxrwxr-x 2 saml saml 4096 Nov 15 20:12 B
-rw-rw-r-- 1 saml saml 0 Nov 15 20:12 c
-rw-rw-r-- 1 saml saml 0 Nov 15 20:12 d
-rw-rw-r-- 1 saml saml 0 Nov 15 20:12 e
-rw-rw-r-- 1 saml saml 0 Nov 15 20:12 f


Now if we try out the above expansions we can see how they'd fair.



$ echo [a-d]
a A b B c d

$ echo a..d
a b c d

$ echo a* b*
a b

$ echo !(B)
a A b c d e f

$ echo !(A|B)
a b c d e f


Extended globbing



There are a variety of other methods you can use to control the way that the shell matches. For example:



 ?(pattern-list) Matches zero or one occurrence of the given patterns
*(pattern-list) Matches zero or more occurrences of the given patterns
+(pattern-list) Matches one or more occurrences of the given patterns
@(pattern-list) Matches one of the given patterns
!(pattern-list) Matches anything except one of the given patterns


You can read more about them in this Linux Journal article titled: Bash Extended Globbing.






share|improve this answer

























  • Or xdg-open a..d

    – Bernhard
    Nov 15 '13 at 21:53











  • @Bernhard - thanks, I added it to Q. You could've edited it in yourself, I don't mind.

    – slm
    Nov 15 '13 at 21:55











  • I'm guessing the OP doesn't actually have files called a...d.

    – Joseph R.
    Nov 15 '13 at 22:47











  • @JosephR. - yeah sorry I stubs this out today at work but then got busy and didn't' finish it as I had planned then. See it now, this was what I had in mind.

    – slm
    Nov 16 '13 at 1:28











  • It's still dependent on file names being easy to match via single-letter globs. How can I adapt this solution to a situation where I have files called foo, bar and glarb?

    – Joseph R.
    Nov 16 '13 at 1:30


















0














Using the zsh shell (from e.g. an interactive bash shell):



zsh -c 'xdg-open A/*(.)'


This would use the . glob modifier in zsh that makes A/* only match regular files under the A directory. To also match symbolic links to regular files use A/*(-.) as the globbing pattern.






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%2f101350%2fusing-globbing-wildcards-when-opening-files-from-terminal%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    How about find A -maxdepth 1 -type f -exec xdg-open ;



    That should open all files in folder A without going any further than the top level.






    share|improve this answer























    • That'll work, but it's a pretty long command. I could alias it, but I feel as if a more elegant solution has to be possible...

      – Newb
      Nov 15 '13 at 22:41











    • As far as I'm aware that's the closest your gonna get to what you need.

      – Jeight
      Nov 15 '13 at 23:03











    • This seems like the best option.

      – coteyr
      Nov 16 '13 at 0:58











    • @coteyr - You can do better than this using extended globbing in Bash! See my updated answer.

      – slm
      Nov 16 '13 at 1:28












    • @slm, I think the globbing is nice but it seems to be "harder" to use unless you want to "know" the folders content. This answer can just be run with out any special knowledge of the directory.

      – coteyr
      Nov 16 '13 at 4:59















    3














    How about find A -maxdepth 1 -type f -exec xdg-open ;



    That should open all files in folder A without going any further than the top level.






    share|improve this answer























    • That'll work, but it's a pretty long command. I could alias it, but I feel as if a more elegant solution has to be possible...

      – Newb
      Nov 15 '13 at 22:41











    • As far as I'm aware that's the closest your gonna get to what you need.

      – Jeight
      Nov 15 '13 at 23:03











    • This seems like the best option.

      – coteyr
      Nov 16 '13 at 0:58











    • @coteyr - You can do better than this using extended globbing in Bash! See my updated answer.

      – slm
      Nov 16 '13 at 1:28












    • @slm, I think the globbing is nice but it seems to be "harder" to use unless you want to "know" the folders content. This answer can just be run with out any special knowledge of the directory.

      – coteyr
      Nov 16 '13 at 4:59













    3












    3








    3







    How about find A -maxdepth 1 -type f -exec xdg-open ;



    That should open all files in folder A without going any further than the top level.






    share|improve this answer













    How about find A -maxdepth 1 -type f -exec xdg-open ;



    That should open all files in folder A without going any further than the top level.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 15 '13 at 22:40









    JeightJeight

    1,88411125




    1,88411125












    • That'll work, but it's a pretty long command. I could alias it, but I feel as if a more elegant solution has to be possible...

      – Newb
      Nov 15 '13 at 22:41











    • As far as I'm aware that's the closest your gonna get to what you need.

      – Jeight
      Nov 15 '13 at 23:03











    • This seems like the best option.

      – coteyr
      Nov 16 '13 at 0:58











    • @coteyr - You can do better than this using extended globbing in Bash! See my updated answer.

      – slm
      Nov 16 '13 at 1:28












    • @slm, I think the globbing is nice but it seems to be "harder" to use unless you want to "know" the folders content. This answer can just be run with out any special knowledge of the directory.

      – coteyr
      Nov 16 '13 at 4:59

















    • That'll work, but it's a pretty long command. I could alias it, but I feel as if a more elegant solution has to be possible...

      – Newb
      Nov 15 '13 at 22:41











    • As far as I'm aware that's the closest your gonna get to what you need.

      – Jeight
      Nov 15 '13 at 23:03











    • This seems like the best option.

      – coteyr
      Nov 16 '13 at 0:58











    • @coteyr - You can do better than this using extended globbing in Bash! See my updated answer.

      – slm
      Nov 16 '13 at 1:28












    • @slm, I think the globbing is nice but it seems to be "harder" to use unless you want to "know" the folders content. This answer can just be run with out any special knowledge of the directory.

      – coteyr
      Nov 16 '13 at 4:59
















    That'll work, but it's a pretty long command. I could alias it, but I feel as if a more elegant solution has to be possible...

    – Newb
    Nov 15 '13 at 22:41





    That'll work, but it's a pretty long command. I could alias it, but I feel as if a more elegant solution has to be possible...

    – Newb
    Nov 15 '13 at 22:41













    As far as I'm aware that's the closest your gonna get to what you need.

    – Jeight
    Nov 15 '13 at 23:03





    As far as I'm aware that's the closest your gonna get to what you need.

    – Jeight
    Nov 15 '13 at 23:03













    This seems like the best option.

    – coteyr
    Nov 16 '13 at 0:58





    This seems like the best option.

    – coteyr
    Nov 16 '13 at 0:58













    @coteyr - You can do better than this using extended globbing in Bash! See my updated answer.

    – slm
    Nov 16 '13 at 1:28






    @coteyr - You can do better than this using extended globbing in Bash! See my updated answer.

    – slm
    Nov 16 '13 at 1:28














    @slm, I think the globbing is nice but it seems to be "harder" to use unless you want to "know" the folders content. This answer can just be run with out any special knowledge of the directory.

    – coteyr
    Nov 16 '13 at 4:59





    @slm, I think the globbing is nice but it seems to be "harder" to use unless you want to "know" the folders content. This answer can just be run with out any special knowledge of the directory.

    – coteyr
    Nov 16 '13 at 4:59













    1














    Method #1 - Shell expansions



    If you know that the items you're after are sequentially named you can use shell expansions in a variety of ways.



    Examples



    $ xdg-open [a-d]
    $ xdg-open a..d
    $ xdg-open a* b*


    Method #2 - Extended globbing



    In Bash (versions 3.2+) you can use extended globbing to included everything except something, which I believe is what you're asking for.



    Examples



    $ xdg-open !(B)
    $ xdg-open !(A|B)


    Demos



    I'll often times use echo so I can see what the globstar or extended globbing will work out to be without actually running a real command on the expanded lists of files and/or directories.



    Example



    Say for example I have the following directory of files.



    $ ls -l
    total 8
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 a
    drwxrwxr-x 2 saml saml 4096 Nov 15 20:23 A
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 b
    drwxrwxr-x 2 saml saml 4096 Nov 15 20:12 B
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 c
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 d
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 e
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 f


    Now if we try out the above expansions we can see how they'd fair.



    $ echo [a-d]
    a A b B c d

    $ echo a..d
    a b c d

    $ echo a* b*
    a b

    $ echo !(B)
    a A b c d e f

    $ echo !(A|B)
    a b c d e f


    Extended globbing



    There are a variety of other methods you can use to control the way that the shell matches. For example:



     ?(pattern-list) Matches zero or one occurrence of the given patterns
    *(pattern-list) Matches zero or more occurrences of the given patterns
    +(pattern-list) Matches one or more occurrences of the given patterns
    @(pattern-list) Matches one of the given patterns
    !(pattern-list) Matches anything except one of the given patterns


    You can read more about them in this Linux Journal article titled: Bash Extended Globbing.






    share|improve this answer

























    • Or xdg-open a..d

      – Bernhard
      Nov 15 '13 at 21:53











    • @Bernhard - thanks, I added it to Q. You could've edited it in yourself, I don't mind.

      – slm
      Nov 15 '13 at 21:55











    • I'm guessing the OP doesn't actually have files called a...d.

      – Joseph R.
      Nov 15 '13 at 22:47











    • @JosephR. - yeah sorry I stubs this out today at work but then got busy and didn't' finish it as I had planned then. See it now, this was what I had in mind.

      – slm
      Nov 16 '13 at 1:28











    • It's still dependent on file names being easy to match via single-letter globs. How can I adapt this solution to a situation where I have files called foo, bar and glarb?

      – Joseph R.
      Nov 16 '13 at 1:30















    1














    Method #1 - Shell expansions



    If you know that the items you're after are sequentially named you can use shell expansions in a variety of ways.



    Examples



    $ xdg-open [a-d]
    $ xdg-open a..d
    $ xdg-open a* b*


    Method #2 - Extended globbing



    In Bash (versions 3.2+) you can use extended globbing to included everything except something, which I believe is what you're asking for.



    Examples



    $ xdg-open !(B)
    $ xdg-open !(A|B)


    Demos



    I'll often times use echo so I can see what the globstar or extended globbing will work out to be without actually running a real command on the expanded lists of files and/or directories.



    Example



    Say for example I have the following directory of files.



    $ ls -l
    total 8
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 a
    drwxrwxr-x 2 saml saml 4096 Nov 15 20:23 A
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 b
    drwxrwxr-x 2 saml saml 4096 Nov 15 20:12 B
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 c
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 d
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 e
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 f


    Now if we try out the above expansions we can see how they'd fair.



    $ echo [a-d]
    a A b B c d

    $ echo a..d
    a b c d

    $ echo a* b*
    a b

    $ echo !(B)
    a A b c d e f

    $ echo !(A|B)
    a b c d e f


    Extended globbing



    There are a variety of other methods you can use to control the way that the shell matches. For example:



     ?(pattern-list) Matches zero or one occurrence of the given patterns
    *(pattern-list) Matches zero or more occurrences of the given patterns
    +(pattern-list) Matches one or more occurrences of the given patterns
    @(pattern-list) Matches one of the given patterns
    !(pattern-list) Matches anything except one of the given patterns


    You can read more about them in this Linux Journal article titled: Bash Extended Globbing.






    share|improve this answer

























    • Or xdg-open a..d

      – Bernhard
      Nov 15 '13 at 21:53











    • @Bernhard - thanks, I added it to Q. You could've edited it in yourself, I don't mind.

      – slm
      Nov 15 '13 at 21:55











    • I'm guessing the OP doesn't actually have files called a...d.

      – Joseph R.
      Nov 15 '13 at 22:47











    • @JosephR. - yeah sorry I stubs this out today at work but then got busy and didn't' finish it as I had planned then. See it now, this was what I had in mind.

      – slm
      Nov 16 '13 at 1:28











    • It's still dependent on file names being easy to match via single-letter globs. How can I adapt this solution to a situation where I have files called foo, bar and glarb?

      – Joseph R.
      Nov 16 '13 at 1:30













    1












    1








    1







    Method #1 - Shell expansions



    If you know that the items you're after are sequentially named you can use shell expansions in a variety of ways.



    Examples



    $ xdg-open [a-d]
    $ xdg-open a..d
    $ xdg-open a* b*


    Method #2 - Extended globbing



    In Bash (versions 3.2+) you can use extended globbing to included everything except something, which I believe is what you're asking for.



    Examples



    $ xdg-open !(B)
    $ xdg-open !(A|B)


    Demos



    I'll often times use echo so I can see what the globstar or extended globbing will work out to be without actually running a real command on the expanded lists of files and/or directories.



    Example



    Say for example I have the following directory of files.



    $ ls -l
    total 8
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 a
    drwxrwxr-x 2 saml saml 4096 Nov 15 20:23 A
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 b
    drwxrwxr-x 2 saml saml 4096 Nov 15 20:12 B
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 c
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 d
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 e
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 f


    Now if we try out the above expansions we can see how they'd fair.



    $ echo [a-d]
    a A b B c d

    $ echo a..d
    a b c d

    $ echo a* b*
    a b

    $ echo !(B)
    a A b c d e f

    $ echo !(A|B)
    a b c d e f


    Extended globbing



    There are a variety of other methods you can use to control the way that the shell matches. For example:



     ?(pattern-list) Matches zero or one occurrence of the given patterns
    *(pattern-list) Matches zero or more occurrences of the given patterns
    +(pattern-list) Matches one or more occurrences of the given patterns
    @(pattern-list) Matches one of the given patterns
    !(pattern-list) Matches anything except one of the given patterns


    You can read more about them in this Linux Journal article titled: Bash Extended Globbing.






    share|improve this answer















    Method #1 - Shell expansions



    If you know that the items you're after are sequentially named you can use shell expansions in a variety of ways.



    Examples



    $ xdg-open [a-d]
    $ xdg-open a..d
    $ xdg-open a* b*


    Method #2 - Extended globbing



    In Bash (versions 3.2+) you can use extended globbing to included everything except something, which I believe is what you're asking for.



    Examples



    $ xdg-open !(B)
    $ xdg-open !(A|B)


    Demos



    I'll often times use echo so I can see what the globstar or extended globbing will work out to be without actually running a real command on the expanded lists of files and/or directories.



    Example



    Say for example I have the following directory of files.



    $ ls -l
    total 8
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 a
    drwxrwxr-x 2 saml saml 4096 Nov 15 20:23 A
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 b
    drwxrwxr-x 2 saml saml 4096 Nov 15 20:12 B
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 c
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 d
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 e
    -rw-rw-r-- 1 saml saml 0 Nov 15 20:12 f


    Now if we try out the above expansions we can see how they'd fair.



    $ echo [a-d]
    a A b B c d

    $ echo a..d
    a b c d

    $ echo a* b*
    a b

    $ echo !(B)
    a A b c d e f

    $ echo !(A|B)
    a b c d e f


    Extended globbing



    There are a variety of other methods you can use to control the way that the shell matches. For example:



     ?(pattern-list) Matches zero or one occurrence of the given patterns
    *(pattern-list) Matches zero or more occurrences of the given patterns
    +(pattern-list) Matches one or more occurrences of the given patterns
    @(pattern-list) Matches one of the given patterns
    !(pattern-list) Matches anything except one of the given patterns


    You can read more about them in this Linux Journal article titled: Bash Extended Globbing.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 16 '13 at 1:38

























    answered Nov 15 '13 at 21:45









    slmslm

    255k71539687




    255k71539687












    • Or xdg-open a..d

      – Bernhard
      Nov 15 '13 at 21:53











    • @Bernhard - thanks, I added it to Q. You could've edited it in yourself, I don't mind.

      – slm
      Nov 15 '13 at 21:55











    • I'm guessing the OP doesn't actually have files called a...d.

      – Joseph R.
      Nov 15 '13 at 22:47











    • @JosephR. - yeah sorry I stubs this out today at work but then got busy and didn't' finish it as I had planned then. See it now, this was what I had in mind.

      – slm
      Nov 16 '13 at 1:28











    • It's still dependent on file names being easy to match via single-letter globs. How can I adapt this solution to a situation where I have files called foo, bar and glarb?

      – Joseph R.
      Nov 16 '13 at 1:30

















    • Or xdg-open a..d

      – Bernhard
      Nov 15 '13 at 21:53











    • @Bernhard - thanks, I added it to Q. You could've edited it in yourself, I don't mind.

      – slm
      Nov 15 '13 at 21:55











    • I'm guessing the OP doesn't actually have files called a...d.

      – Joseph R.
      Nov 15 '13 at 22:47











    • @JosephR. - yeah sorry I stubs this out today at work but then got busy and didn't' finish it as I had planned then. See it now, this was what I had in mind.

      – slm
      Nov 16 '13 at 1:28











    • It's still dependent on file names being easy to match via single-letter globs. How can I adapt this solution to a situation where I have files called foo, bar and glarb?

      – Joseph R.
      Nov 16 '13 at 1:30
















    Or xdg-open a..d

    – Bernhard
    Nov 15 '13 at 21:53





    Or xdg-open a..d

    – Bernhard
    Nov 15 '13 at 21:53













    @Bernhard - thanks, I added it to Q. You could've edited it in yourself, I don't mind.

    – slm
    Nov 15 '13 at 21:55





    @Bernhard - thanks, I added it to Q. You could've edited it in yourself, I don't mind.

    – slm
    Nov 15 '13 at 21:55













    I'm guessing the OP doesn't actually have files called a...d.

    – Joseph R.
    Nov 15 '13 at 22:47





    I'm guessing the OP doesn't actually have files called a...d.

    – Joseph R.
    Nov 15 '13 at 22:47













    @JosephR. - yeah sorry I stubs this out today at work but then got busy and didn't' finish it as I had planned then. See it now, this was what I had in mind.

    – slm
    Nov 16 '13 at 1:28





    @JosephR. - yeah sorry I stubs this out today at work but then got busy and didn't' finish it as I had planned then. See it now, this was what I had in mind.

    – slm
    Nov 16 '13 at 1:28













    It's still dependent on file names being easy to match via single-letter globs. How can I adapt this solution to a situation where I have files called foo, bar and glarb?

    – Joseph R.
    Nov 16 '13 at 1:30





    It's still dependent on file names being easy to match via single-letter globs. How can I adapt this solution to a situation where I have files called foo, bar and glarb?

    – Joseph R.
    Nov 16 '13 at 1:30











    0














    Using the zsh shell (from e.g. an interactive bash shell):



    zsh -c 'xdg-open A/*(.)'


    This would use the . glob modifier in zsh that makes A/* only match regular files under the A directory. To also match symbolic links to regular files use A/*(-.) as the globbing pattern.






    share|improve this answer



























      0














      Using the zsh shell (from e.g. an interactive bash shell):



      zsh -c 'xdg-open A/*(.)'


      This would use the . glob modifier in zsh that makes A/* only match regular files under the A directory. To also match symbolic links to regular files use A/*(-.) as the globbing pattern.






      share|improve this answer

























        0












        0








        0







        Using the zsh shell (from e.g. an interactive bash shell):



        zsh -c 'xdg-open A/*(.)'


        This would use the . glob modifier in zsh that makes A/* only match regular files under the A directory. To also match symbolic links to regular files use A/*(-.) as the globbing pattern.






        share|improve this answer













        Using the zsh shell (from e.g. an interactive bash shell):



        zsh -c 'xdg-open A/*(.)'


        This would use the . glob modifier in zsh that makes A/* only match regular files under the A directory. To also match symbolic links to regular files use A/*(-.) as the globbing pattern.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 days ago









        KusalanandaKusalananda

        139k17259430




        139k17259430



























            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%2f101350%2fusing-globbing-wildcards-when-opening-files-from-terminal%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

            getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

            Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

            Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.