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?
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
add a comment |
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
See my updated answer, extended globbing is what you're looking for.
– slm♦
Nov 16 '13 at 1:29
add a comment |
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
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
bash shell command-line terminal command
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
add a comment |
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
add a comment |
3 Answers
3
active
oldest
votes
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.
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
|
show 1 more comment
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.
Orxdg-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 calleda
...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 calledfoo
,bar
andglarb
?
– Joseph R.
Nov 16 '13 at 1:30
|
show 2 more comments
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
|
show 1 more comment
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.
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
|
show 1 more comment
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.
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.
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
|
show 1 more comment
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
|
show 1 more comment
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.
Orxdg-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 calleda
...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 calledfoo
,bar
andglarb
?
– Joseph R.
Nov 16 '13 at 1:30
|
show 2 more comments
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.
Orxdg-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 calleda
...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 calledfoo
,bar
andglarb
?
– Joseph R.
Nov 16 '13 at 1:30
|
show 2 more comments
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.
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.
edited Nov 16 '13 at 1:38
answered Nov 15 '13 at 21:45
slm♦slm
255k71539687
255k71539687
Orxdg-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 calleda
...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 calledfoo
,bar
andglarb
?
– Joseph R.
Nov 16 '13 at 1:30
|
show 2 more comments
Orxdg-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 calleda
...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 calledfoo
,bar
andglarb
?
– 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
|
show 2 more comments
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.
add a comment |
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.
add a comment |
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.
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.
answered 2 days ago
Kusalananda♦Kusalananda
139k17259430
139k17259430
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
See my updated answer, extended globbing is what you're looking for.
– slm♦
Nov 16 '13 at 1:29