New answers tagged

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 ...
Ricky Levi's user avatar
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 ...
don_crissti's user avatar
  • 79.8k
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 ...
hh skladby's user avatar
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 ...
Kusalananda's user avatar
  • 323k
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_/}" ...
terdon's user avatar
  • 235k
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 ...
Forivin's user avatar
  • 817
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'...
ilkkachu's user avatar
  • 134k
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 ...
Kaz's user avatar
  • 7,781

Top 50 recent answers are included