7
votes
Accepted
Allow unicode characters in zsh shell variable names on MacOS
Zsh variable names have to be made of alphanumeric characters only, and the first one can't be an ASCII digit which is reserved for position parameters. When the posixidentifiers option is enabled (...
3
votes
Accepted
zsh - Param expansion to join all elements of an assoc array, with separator in between?
There is not an expansion in zsh that will directly process pairs like that, but one succinct option is to use print -f and assign the results to an array:
typeset -a arr
print -f '%s==%s' -v arr -m '*...
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
zsh × 3143bash × 584
shell × 541
autocomplete × 334
shell-script × 309
oh-my-zsh × 272
macos × 197
terminal × 163
command-history × 159
command-line × 130
wildcards × 129
alias × 122
prompt × 117
linux × 85
tmux × 77
environment-variables × 73
function × 66
keyboard-shortcuts × 64
ssh × 58
path × 56
scripting × 54
zle × 53
colors × 50
quoting × 46
git × 46