Bash Extended Globbing
|
|
|
Comments (13)
I always just say * .??* to mean all files.
Of course the ?? after the dot is to keep it from matching . and ..
Of course the ?? after the dot is to keep it from matching . and ..
But that fails to match dotfiles with less than three characters.
I use ".[0-9A-Za-z]*" to match the hidden files and directories. In my $HOME, I have none with strange symbols after the first dot, so that pattern matches well enough for me.
> But that fails to match dotfiles with less than three characters.
Did I make a typo? In that case, use .?
Did I make a typo? In that case, use .?
> Did I make a typo? In that case, use .?
But .? should match ..
But .? should match ..
Quoting:I use ".[0-9A-Za-z]*" to match the hidden files and directories.
What if I drop a file called ".?ó??"? :) I usually use this one: .[^.]*
Argh. There are supposed to be funny characters in my example filename, not question marks.
Who wrote this forum software?? ;P
Ha! I just found the 'dotglob' option. run "shopt -s dotglob" and now * will match dotfiles but not . and ..
> Ha! I just found the 'dotglob' option. run "shopt -s dotglob" and now * will match dotfiles but not . and ..
Very good to know - and it just goes to show you, no matter how long you stay in this game, there is always something new to learn.
Very good to know - and it just goes to show you, no matter how long you stay in this game, there is always something new to learn.
Dot-question and dot-dot are dangerous, because they will take you up instead of down.
@jezuch:
The forum began mis-behaving after the blackout recovery.
@jezuch:
The forum began mis-behaving after the blackout recovery.
> Dot-question and dot-dot are dangerous, because they will take you up instead of down.
Yep, that's why we say .?? to avoid matching . or ..
Yep, that's why we say .?? to avoid matching . or ..
Quoting:Yep, that's why we say .?? to avoid matching . or ..
Or .a or .b or... ;)
Post a comment
A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.
Your message:Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help
Sign up and post (it is free) or Log in and post

It often happens that I want to move/copy all files from one directory to another but then it leave behind .htaccess files and the like.