New answers tagged wildcards
0
votes
delete directory with special character in filename
I had such directory:
$ ll
total 0
drwxrwxr-x 2 user user 57 Oct 2 12:41 mydir.d
drwxrwxr-x 2 user user 38 Oct 2 12:30 'mydir.d }}'
And at first i thought that the ' is part of the name of the ...
7
votes
Accepted
Command line glob to view multiple images using ImageMagick's display
If you don't specify a delay, imagemagick will load the first image and wait for your input, that is
SPACE - load next image
BACKSPACE - load previous image
If you want to display the images in ...
0
votes
Portable check empty directory
If you don't need to consider dot files:
test your_dir/* = "your_dir/*" 2>/dev/null && echo 'empty' || echo 'not empty'
Mind the difference between the path your_dir/* and the ...
0
votes
Changing file names based on enclosing directory
It's not clear from the question how the files should be renamed, so I'm going to assume that they should be renamed by appending the name of their original directory to their original name.
The code ...
1
vote
Accepted
How to reuse matched value in bash globbing?
While there is no direct equivalent to regex capture groups in the shell, what you describe is usually done using variables. For example:
$ for f in file_*.txt; do
number="${f/file_/}"
...
1
vote
How to do wildcard/glob expansion when the pattern and the resolved pathes contain spaces?
Thanks to the comment by @ilkkatchu, I now understand that I simply have to use something else than echo, so I came up with a simple inline bash script that prints every received argument as one line ...
4
votes
How to do wildcard/glob expansion when the pattern and the resolved pathes contain spaces?
It seems like basic shell expansion just resolves the paths and separates them by space,
It's not that stupid, and that couldn't even work. The key here is that when the command line is processed, it'...
3
votes
How to do wildcard/glob expansion when the pattern and the resolved pathes contain spaces?
When the globbing operators like * and ? are quoted, their special meaning is disabled. However, you need quoting or escaping to protect spaces. The solution is to quote or escape only the parts of ...
Top 50 recent answers are included
Related Tags
wildcards × 1189bash × 447
shell × 308
shell-script × 130
zsh × 119
files × 98
find × 93
ls × 85
regular-expression × 69
command-line × 66
filenames × 64
quoting × 64
grep × 62
linux × 42
rm × 34
directory × 29
rsync × 25
awk × 23
cp × 23
sed × 22
tar × 22
pattern-matching × 21
rename × 19
recursive × 19
scripting × 18