mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-19 03:25:44 +00:00
Wildcards (*
) should always be in single quotes
Otherwise bash might expand with if matches are found
This commit is contained in:
parent
b01259c674
commit
474823fbd7
@ -1,5 +1,5 @@
|
|||||||
# To find files by case-insensitive extension (ex: .jpg, .JPG, .jpG):
|
# To find files by case-insensitive extension (ex: .jpg, .JPG, .jpG):
|
||||||
find . -iname "*.jpg"
|
find . -iname '*.jpg'
|
||||||
|
|
||||||
# To find directories:
|
# To find directories:
|
||||||
find . -type d
|
find . -type d
|
||||||
@ -51,4 +51,4 @@ find . -type f -exec chmod 644 {} \;
|
|||||||
find . -iname '*.txt' -exec vim {} \+
|
find . -iname '*.txt' -exec vim {} \+
|
||||||
|
|
||||||
# To find all files with extension '.png' and rename them by changing extension to '.jpg' (base name is preserved)
|
# To find all files with extension '.png' and rename them by changing extension to '.jpg' (base name is preserved)
|
||||||
find . -type f -iname "*.png" -exec bash -c 'mv "$0" "${0%.*}.jpg"' {} \;
|
find . -type f -iname '*.png' -exec bash -c 'mv "$0" "${0%.*}.jpg"' {} \;
|
||||||
|
Loading…
Reference in New Issue
Block a user