3
votes
Case-insensitive pattern replacement in Zsh parameter expansion
I can make it work inline:
% zsh -c 'setopt extendedglob;echo ${0/%(#i).jpg/.jpeg}' toto.JPG
toto.JPG
or in a separate script:
% cat myrename
#!/usr/bin/env zsh
setopt extendedglob
mv -- $1 ${1/%(#i)....
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
wildcards × 1233bash × 461
shell × 311
shell-script × 133
zsh × 129
files × 99
find × 96
ls × 88
regular-expression × 71
command-line × 66
grep × 66
quoting × 65
filenames × 63
linux × 42
rm × 34
directory × 30
rsync × 25
cp × 25
pattern-matching × 24
awk × 23
sed × 22
tar × 22
scripting × 19
rename × 19
recursive × 19