ZSHEXPN(1) General Commands Manual ZSHEXPN(1) (NAME) zshexpn - zsh (DESCRIPTION) : (History Expansion) . (Alias Expansion) Aliasing zshmisc(1) . (Process Substitution) (Parameter Expansion) (Command Substitution) (Arithmetic Expansion) (Brace Expansion) -- . . . `\' `'' `"' . (Filename Expansion) SH_FILE_EXPANSION sh ksh . . (Filename Generation) globbing . . (HISTORY EXPANSION) . . HISTSIZE . . (event) () . (prompt) ( EXPANSION OF PROMPT SEQUENCES zshmisc(1) ) . (Overview) histchars `!' ( '...' $'...' ). ( `Event Designators' ) ( `Word Designators' ) . (echo) . . . . CSH_JUNKIE_HISTORY . `!' `!!:1' `!!$' . CSH_JUNKIE_HISTORY `!:1' `!$' `!!:1' `!!$' . CSH_JUNKIE_HISTORY `!:1' `!$' . `^foo^bar' ( `^' histchars ) bar foo . `^foo^bar^' `!!:s^foo^bar^' ( `Modifiers' ) `^' . `^foo^bar^:G' . `!"' ( zshmisc(1) ) . `!"' `!' . fc ..SS " (Event Designators)" (history) . `!' histchars . ! `=' `(' . ( ` ` ) ( ` ` ). !! . . !n n. !-n n. !str str . !?str[?] str . `?' str . !# . `!#' ( ) . !{...} ( ). (Word Designators) . `:' . `^' `$' `*' `-' `%' . : 0 (). n n. ^ 1. $ . % () ?str . x-y x 0 . * . x* `x-$'. x- `x*' $. `%' `!%' `!:%' `!?str?:%' !? ( ) . ..SS " (Modifiers)" (word designator) <<:>> . (filename generation) (parameter expansion) . a : <<.>> <<..>> . . CHASE_DOTS CHASE_LINKS . <> <> <> ( ) . A <> realpath(3) . : realpath(3) <> <> . : foo:A realpath(foo) . realpath(foo) <

> . c PATH. . glob . e <<.>> r . <<.>> . h [ digits ] : <<>> (head) . <> . h ( ) . <> var=/my/path/to/something ${var:h3} /my/path . <> <> . $var:h2 ${var:h}2 ${var:h2}. globbing . ( <> ). l . p . (history expansion) . P realpath(3). <<.>> <<..>> . realpath(3) . q (quote) . eval. Q . r (root name). . <<.>> ( ) <<.>> <> . <> <<.c>> <> . s/l/r[/] r l . l . . . <> <> l r . g :G . . & s. s g . & (quote) . t [ digits ] ( tail). <> . . (h) . u . x q (whitespace). . s/l/r/ . . <> . . <<&>> r l . <<&>> . l l s <> . r <> . l r . <<&>> glob & . l r . l r ( HIST_SUBST_PATTERN ). r l . glob <<:s>> l r . HIST_SUBST_PATTERN l FILENAME GENERATION . globbing (quote) . globbing glob (#q:s/.../.../) glob . NO_BAD_PATTERN ..PP HIST_SUBST_PATTERN l # % # . % # . EXTENDED_GLOB: print -r -- *.c(#q:s/#%(#b)s(*).c/'S${match[1]}.C'/) *.c glob (#q...) (#%) . ((#b)) ${match[1]} . . f F w W . . f ( ) . F:expr: f expr n n . `:' `(' `[' `{' ')' `]' `}' . w . W:sep: w sep . `:' . (PROCESS SUBSTITUTION) `<(list)' `>(list)' `=(list)' . . . `<<(list)' `< <(list)' . . ( ) . < > list . /dev/fd (FIFO) . > list . < list . paste <(cut -f1 file1) <(cut -f3 file2) | tee >(process1) >(process2) >/dev/null file1 file2 process1 process2 . <(...) =(...) list . < lseek ( lseek(2)) . =(<< arg here-string <<< . arg . . $( arg . = /dev/fd <(...) . setuid . ( ) . lseek ( lseek(2)) . ( MULTIOS ) : paste <(cut -f1 file1) <(cut -f3 file2) > >(process1) > >(process2) FIFO (pipes) . >(process) process . MULTIOS zshmisc(1) . : paste <(cut -f1 file1) <(cut -f3 file2) > >(process) ( MULTIOS ) process . : { paste <(cut -f1 file1) <(cut -f3 file2) } > >(process) . (disown) `&!' `&|' . . : (mycmd =(myoutput)) &! . ( ). :.PP () { print File $1: cat $1 } =(print This be the verse) : File /tmp/zsh6nU0kS: This be the verse . (PARAMETER EXPANSION) `$' . zshparam(1) . (whitespace) SH_WORD_SPLIT . . (null) . : array=("first word" "" "third word") scalar="only word" $array `first word' `third word' $scalar `only word' . array . () . : "$scalar" "${array[@]}" "${(@)array}" . ( .) `${(@kv)aliases}' `${PREFIX:-"/usr/local"}'. . . . `Filename Generation' . . `Modifiers' `History Expansion' : ${i:s/foo/bar/} $i . `word' . ${name} name . name . KSH_ARRAYS `^' `=' `~' `#' `+' . name KSH_ARRAYS name . KSH_ARRAYS . SH_WORD_SPLIT . = s:string: . ${+name} name `1' `0' . ${name-word} ${name:-word} name (non-null) word . name word . ${name+word} ${name:+word} name word . ${name=word} ${name:=word} ${name::=word} name word name word name word . name . ${name?word} ${name:?word} name name word . . word . word . word word SH_WORD_SPLIT = s:string: . name `(@)' name[@] . ${name#pattern} ${name##pattern} pattern name name name . . ${name%pattern} ${name%%pattern} pattern name name name . . ${name:#pattern} pattern name name . name ( `(M)' )..TP ${name:|arrayname} arrayname (: ) arrayname name . name arrayname . ${name:*arrayname} ( arrayname) . ${name:^arrayname} ${name:^^arrayname} ( ) ( <<:^^>> ) name arrayname . <<:^>> . a=(1 2 3 4); b=(a b); print ${a:^b} <<1 a 2 b>> . <<:^^>> <<1 a 2 b 3 a 4 b>> . . . <> <<1>> . print . a=(a b); b=(1 2); print -l "${a:^b}"; print -l "${${a:^b}}" ${name:offset} ${name:offset:length} $name[start,end] offset length . offset name offset name offset . length . offset name ( zsh ). KSH_ARRAYS 0 . -1 . length offset . length . offset . MULTIBYTE . offset length . print ${foo:3} print ${foo: 1 + 2} print ${foo:$(( 1 + 2))} print ${foo:$(echo 1 + 2)} $foo $foo . KSH_ARRAYS $foo ( ) foo ${foo[*]:3} . offset - : ${name:-word} . - . offset length & . $ ( ) ${var: offs} $offs . 0 . . ( $@ $*) 0 $0 1 $1 . $0 . ${*:0:1} $0 ${*:1:1} $1 . ${name/pattern/repl} ${name//pattern/repl} ${name:/pattern/repl} pattern name repl . pattern . pattern repl (double-quoted) ${name/$opat/$npat} $opat GLOB_SUBST $opat ${~opat} . pattern <<#>> pattern <<%>> <<#%>> pattern . repl <> . <> <> . <<#>> <<%>> <<#%>> . ${name} . I S M R B E N . foo="twinkle twinkle little star" sub="t*e" rep="spy" print ${foo//${~sub}/$rep} print ${(S)foo//${~sub}/$rep} <<~>> $sub . t*e <> <> . ${#spec} spec . spec . (joining) spec . <<^>> <<=>> <<~>> <<#>> . POSIX_IDENTIFIERS spec $#- $#* $- $* . POSIX_IDENTIFIERS # . ${^spec} ${^^spec} RC_EXPAND_PARAM spec <<^>> . foo${xx}bar xx (a b c) <> <> . . . ${^var} {$var[1],$var[2],...} `Brace Expansion' : . (word splitting) $var[N] . ${=spec} ${==spec} SH_WORD_SPLIT spec <<=>> . IFS . . word spec name . A . ${~spec} ${~~spec} GLOB_SUBST spec <<~>> . (filename generation) <<=>> <> . ~ . . foo * ${~foo//\*/*.c} *.c ${${~foo}//\*/*.c} *.c . ${...} $(...) name name . : ${${foo#head}%tail} $foo <> <> . $(...) . name ${...} (subscript expression) Array Parameters zshparam(1) . (quoted) ${(f)"$(foo)"} $(foo) <<(f)>> ( ) . "${(@f)"$(foo)"}" () $(foo) . . `(q%q%q)' `(%%qqq)' . : # . . # . MULTIBYTE 127 ( ASCII ) . % % (prompts) ( EXPANSION OF PROMPT SEQUENCES zshmisc(1) ). PROMPT_PERCENT PROMPT_SUBST PROMPT_BANG . @ . `"${(@)foo}"' `"${foo[@]}"' `"${(@)foo[1,2]}"' `"$foo[1]" "$foo[2]"' . f s z . A . . ${${(A)name}[1]} name name . `${...=...}' `${...:=...}' `${...::=...}' . ( `AA') . (padding) word . name word `${(AA)=name=...}' . . a `O' . `a' `Oa' . b . GLOB_SUBST ${~...} . q GLOB_SUBST . pattern=${(q)str} [[ $str = ${~pattern} ]] $str `a*b' `a b' pattern=${(b)str} [[ $str = ${~pattern} ]] $str . c ${#name} . (join) . C (Capitalize) . <<>> . D . ( ) . `~' : FILENAME EXPANSION . e . . f (newlines) . `ps:\n:' . F . `pj:\n:' . g:opts: (g::) echo . o . c `^X' . e `\M-t' print . o e print `\c' . i . `n' `O' . k name ( ) . ( ) . . KSH_ARRAYS `[*]' `[@]' . L . n . `+' `-' . . `foo+24 foo1 foo02 foo2 foo3 foo20 foo23' . `i' `O' . - n . . `+' ( ). o ( (locale) ). `a' `i' `n' `-' . O `O' `a' `i' `n' `-' . `a' `i' `n' `-' . P name . typeset ( / ) name . . `foo=bar' `bar=baz' ${(P)foo} ${(P)${foo}} ${(P)$(echo bar)} `baz' . . . `name=assoc' assoc `${${(P)name}[elt]}' `elt' . q (quote) $'\NNN' (octet) . (single quotes) (double quotes) . $ . . q- ( q ) . . q+ $'...' . typeset . Q . t . (`-') . `scalar' `array' `integer' `float' `association' . : local left right_blanks right_zeros lower upper readonly tag tied PATH ( ) path () `typeset -T' export (export) unique hide `hide' hideval `hideval' special u . U . v k ( ) . . V () . w ${#name} s . W w . X Q e # `${name#pattern}' . . z . INTERACTIVE_COMMENTS ( Z ) `(s)'. `${${(z)foo}[2]}' . `${(Q)${(z)foo}}' . 0 (null bytes) . `ps:\0:' . ( p) . `(...)' `{...}' `[...]' `<...>' . p print . $var . . sep=: val=a:b:c print ${(ps.$sep.)val} : . ~ . ~ . ~ . [[ "?" = ${(~j.|.)array} ]] `|' $array `?' . ~ . j:string: string . s:string: SH_WORD_SPLIT . l:expr::string1::string2: . expr . :string1: :string2: . . string1 ( ) string1 . string1 string2 string2 string1 ( ). string1 string2 $IFS . MULTIBYTE m . MULTIBYTE . . m l r # MULTIBYTE . . . . m ( ) . ( ) ( ). r:expr::string1::string2: l string2 . . . . s:string: string . string IFS . = SH_WORD_SPLIT . . : line="one::three" print -l "${(s.:.)line}" one three . `(@)' "${(@s.:.)line}". Z:opts: z . z . : (Z+c+) . (Z+C+) . : $HISTCHARS ( #) . (Z+n+) . (Z+Cn+). _:flags: (_) . zsh flags . ${...#...} ${...%...} . S I * ${.../...} . S # ## ( ` '). # ## : % str="aXbXc" % echo ${(S)str#X*} abXc % echo ${(S)str##X*} a % % %% : % str="aXbXc" % echo ${(S)str%X*} aXbc % echo ${(S)str%%X*} aXb % ( % %% .) ${.../...} ${...//...} (non-greedy) : % str="abab" % echo ${str/*b/_} _ % echo ${(S)str/*b/_} _ab % I:expr: expr ( expr ). S ${.../...} ( expr ) ${...//...} ( expr ). . expr . ${...%...} ${...%%...} . which switch is the right switch for Ipswich? ${(SI:N:)string#w*ch} N `which' `witch' `witch' `wich' `##' `which switch is the right switch for Ipswich' `witch is the right switch for Ipswich' `witch for Ipswich' `wich' . `%' `#' `%%' `##' . * EXTENDED_GLOB ${.../...} ${...//...}. `**' extendedglob . B . E ( ). M . N . R ( Rest). (Rules) ${...}. . Zsh . 1. ${...} . (double quotes) . . . `(P)' ${${foo}} ${foo} . `(P)' ${${(P)foo}} ${(P)foo} . ( ) ( ~ = ). ${${:-=cat}:h} cat . (: =cat :h .) 2. typeset -L -R -Z -u -l (padding) / . `typeset -Z' . `(P)' ( 4.) . / ${${(P)foo}} ( 25.) . 3. ${var[3]} . . var ${var[1][2]} ${var[2,4][2]} ( ). . `(k)' `(v)' . 4. `(P)' . ( ) . `(P)' . ( 2.) . 5. (double quotes) `(@)' `#' $IFS ( ) ( ). `(j)' $IFS . 6. ( ) . 3. . ${foo[2,4][2]} ${${foo[2,4]}[2]} "${${(@)foo[2,4]}[2]}" ( ) "${${foo[2,4]}[2]}" ( ). 7. `#' `%' `/' ( ) `:...' ( `Modifiers' `History Expansion' ) . 8. `(#)' . 9. `#' ${#var} ..TP 10. `(j)' `(j)' 11. 5. $IFS . `(F)' . 11. `(s)' `(f)' `=' ( ${=var}) ( `=' ) $IFS . `(s)' `(f)' `=' SH_WORD_SPLIT $IFS . . 12. `(L)' `(U)' `(C)' . 13. `(g)' (prompt) `(%)' . 14. `(q)' `(Q)' . 15. `(D)' . 16. `(V)' . 17. '(z)' '(Z)' . 11. : $IFS . 18. `(u)' . 19. `(o)' `(O)' . 20. RC_EXPAND_PARAM RC_EXPAND_PARAM `^' . 21. `(e)' . 22. (Padding) `(l.fill.)' `(r.fill.)' . 23. IFS . `${(P)${(f)lines}}' ${lines} `(P)' . . 24. . . 25. `(P)' 4. ( ) ( 2.) . f . ${(f)"$( file . $( . . $foo (bar baz) : "${(@)${foo}[1]}" b . "${foo}" (@) "bar baz" . "${(@)...[1]}" ( `(@)') . "${${(@)foo}[1]}" `bar' . "${(@)foo}" `(bar baz)' . "${...[1]}" . "${foo[1]}" . $foo `(ax1 bx1)' . ${(s/x/)foo} `a' `1 b' `1' . ${(j/x/s/x/)foo} `a' `1' `b' `1' . ${(s/x/)foo%%1*} `a' ` b' ( ). (ax bx) "ax bx" `a' ` b' `' . . (COMMAND SUBSTITUTION) `$(...)' ``...`' . IFS . `$(cat foo)' `$( . foo ( ) . GLOB_SUBST . (ARITHMETIC EXPANSION) `$[exp]' `$((exp))' exp . exp . `Arithmetic Evaluation' . (BRACE EXPANSION) `foo{xx,yy,zz}bar' `fooxxbar' `fooyybar' `foozzbar' . . . . `{n1..n2}' n1 n2 n1 n2 . (pad) - . . `{n1..n2..n3}' n1 n2 n3 n3- n1 . n3 n3 n1 n2 . `{-99..100..01}' 0 ( ). `{c1..c2}' c1 c2 ( ) c1 c2 . US ASCII ( ). . `{d..a}' `d c b a' . BRACE_CCL ( `brace character class') . ASCII ( ). [...] : `-' `^' `!' . `{abcdef0-9}' 0 1 2 3 4 5 6 7 8 9 a b c d e f . (globbing) */{foo,bar} */foo */bar . `no match' */(foo|bar) . ${^spec} `Parameter Expansion' . <<~>> . <> <> . <<~>> . <<~>> $HOME . <<~>> <<+>> <<->> . <<~>> (directory stack) . <<~0>> <<~+>> <<~1>> . <<~+>> . <<~+0>> <<~+>> <<~+1>> . <<~->> . <<~-0>> . PUSHD_MINUS <<~+>> <<~->> . (Dynamic named directories) zsh_directory_name zsh_directory_name_functions . . <<~>> namstr . namstr . : n ( name) namstr. reply ( ) . reply . NOMATCH . %~ (prompts). : d ( directory) . reply : ( <<~[...]>> ) . /home/myname/src/zsh /home/myname/src ( ) s : reply=(s 16) ( ) ( ) . n d . d . (completion) <> zsh_directory_name_functions ( ) . zshcompsys(1) . p: /home/pws/perforce . . zsh_directory_name() { emulate -L zsh setopt extendedglob local -a match mbegin mend if [[ $1 = d ]]; then # turn the directory into a name if [[ $2 = (#b)(/home/pws/perforce/)([^/]##)* ]]; then typeset -ga reply reply=(p:$match[2] $(( ${#match[1]} + ${#match[2]} )) ) else return 1 fi elif [[ $1 = n ]]; then # turn the name into a directory [[ $2 != (#b)p:(?*) ]] && return 1 typeset -ga reply reply=(/home/pws/perforce/$match[1]) elif [[ $1 = c ]]; then # complete names local expl local -a dirs dirs=(/home/pws/perforce/*(/:t)) dirs=(p:${^dirs}) _wanted dynamic-dirs expl 'dynamic directory' compadd -S\] -a dirs return else return 1 fi return 0 } `~' - (`_') (`-') (`.') . . `~' `/' . ( ). -d hash . ( %~ ) . `~' . . $PWD $OLDPWD . `=' (`=' expansion) `=' EQUALS . . (Notes) typeset . PATH `~' `=' `:' . `~' `=' ( ) EQUALS . MAGIC_EQUAL_SUBST `identifier=expression' . `=' . (FILENAME GENERATION) `*' `(' `|' `<' `[' `?' GLOB . EXTENDED_GLOB `^' `#' . . NULL_GLOB NOMATCH . `/' `.' `/' GLOB_DOTS . `.' `..' . `/' `.' . (Glob Operators) * (null) . ? . [...] . `-' . `-' `]' . `[:name:]' . ctype(3) : [:alnum:] - [:alpha:] () [:ascii:] - . [:blank:] (blank) [:cntrl:] [:digit:] [:graph:] [:lower:] [:print:] [:punct:] - [:space:] (whitespace) [:upper:] [:xdigit:] (locale) : [:IDENT:] POSIX_IDENTIFIERS [:IFS:] IFS [:IFSSPACE:] IFS IFS zshparam(1) . [:INCOMPLETE:] . . `[[:INCOMPLETE:]]*' . . [:INVALID:] . . [:WORD:] WORDCHARS () - `[[:alnum:]]' . `[[:alpha:]0-9]'. [^...] [!...] [...] . <[x]-[y]> x y . () `<->' . [...] . (wildcards) <0-9>* `<0-9>' `*' . . `<0-9>[^[:digit:]]*' . (...) . . KSH_GLOB `@' `*' `+' `?' `!' `(' . SH_GLOB KSH_GLOB . : `/' ( ). : (pat/)# . foo/(a*/)#bar foo/bar foo/any/bar foo/any/anyother/bar . x|y x y . . `|' (pipeline) . . ^x ( EXTENDED_GLOB .) x . `/' `^foo/bar' `.' `./foo' `bar' . x~y ( EXTENDED_GLOB .) x y . `|' `*/*~foo/bar' `.' `foo/bar' . `foo~bar~baz' . (y) `/' `.' globbing . x# ( EXTENDED_GLOB .) x . `12#' `1(2#)' `(12)#'. `#' `##' KSH_GLOB ( `!(foo)#' `*(!(foo))' ) . x## ( EXTENDED_GLOB .) x . `12##' `1(2##)' `(12)##'. `#' . ( (glob qualifiers) `1(2##)' .).SS " ksh (ksh-like Glob Operators)" KSH_GLOB `@' `*' `+' `?' `!' . `(' . @(...) . ( `(...)'.) *(...) . ( `(...)#' .) +(...) . ( `(...)##' .) ?(...) . ( `(|...)'.) !(...) . ( `(^(...))'.) (Precedence) () `^' `/' `~' `|' () `#' `##' ( `?' `[...]' `<...>' ) . `/' `|' ( case `[[...]]') `/' `/' `~' . (Globbing Flags) EXTENDED_GLOB . (#X) X : i : . l . I : i l . b (backreference) . $match $mbegin $mend . . $mend $mbegin KSH_ARRAYS . . foo="a_string_with_a_message" if [[ $foo = (a|an)_(#b)(*) ]]; then print ${foo[$mbegin[1],$mend[1]]} fi `string_with_a_message' . (#b) . ${array#pattern} ${param//pat/repl} . . m . . `#' `##' . : `[[ abab = (#b)([ab])# ]]' `b' match[1] . : `X((ab|cd)#)Y' `ab' `cd' `X' `Y' $match[2] $match[1] . . -- # -- -1 . . B b . cN,M (#cN,M) # ## `(*/)#' `(*/)##' `/' (bad pattern) . {N,M} . N M . (#cN) N (#c,M) N 0 (#cN,) . m . . $MATCH $MBEGIN $MEND . . arr=(veldt jynx grimps waqf zho buck) print ${arr//(#m)[aeiou]/${(U)MATCH}} ( ) `vEldt jynx grImps wAqf zhO bUck' . . M m . anum : num . . s, e : `(#s)' `(#e)' . `(#s)' `(#e)' `^' `$' . ( ). `*((#s)|/)test((#e)|/)*' `test' : test test/at/start at/end/test in/test/middle. (parameter substitution) `${array/(#s)A*Z(#e)}' `A*Z' . `/' `//' `(#s)' `(#e)' . `(^(#s))' << >> `(""~(#s))' . q `q' globbing . glob . `(#b)(*).c(#q.)' globbing . `(#q.)' glob `(#b)' `(#b)' (backreferences) `(#q.)' . (colon modifiers) glob . u MULTIBYTE_SUPPORT locale . MULTIBYTE . U . ( : Unicode UTF-8 ASCII .) U . u . MULTIBYTE . fooxx (#i)FOOXX (#l)FOOXX (#i)FOO(#I)XX ((#i)FOOX)X . (#ia2)readme readme . ksh KSH_GLOB EXTENDED_GLOB @ . [...] (#i)[a-z] . (#i)/foo/bar/... . (Approximate Matching) (#anum) . : 1. fooxbar fooybar. 2. banana abnana. 3. road rod. 4. stove strove. (#a3)abcd dcba [d][cb][a] [a][bc][d] . (#a1)??? ? . ( GLOB_DOTS ) a/bc ab/c ( ). (ab|cd)ef aebf . ~ . (#a1)README~READ_ME READ.ME READ_ME READ_ME . (#a1)README~(#a1)READ_ME READ?ME . . (#a1)cat((#a0)dog)fox dog (#a1)cat(#a0)dog(#a1)fox . (#a1)abc(#a0)xyz abcdxyz `x' . `(#a1)/foo/d/is/available/at/the/bar' . (#a1) . (#a1) . `(foo/)#' foo . `**/' `(*/)#' . : ls -ld -- (*/)#bar ls -ld -- **/bar `bar' ( `bar' ). (symbolic links) `***/' . (globbing) `*' . GLOB_STAR_SHORT . ** *** / / * . : setopt GLOBSTARSHORT ls -ld -- **.c ls -ld -- **/*.c (Glob Qualifiers) . . BARE_GLOB_QUAL `|' `(' ( `~' ) glob . glob `(^x)' glob `((^x))' . EXTENDED_GLOB glob `(#qx)' x . . glob . AND . glob `|' `(' `~' . glob `*(#q*)(.)' . `[[' (#q...) (globbing) glob (#q) . . : / F <<>> ( ). (^F) . (/^F) . . (plain files) @ (symbolic links) = (sockets) p (FIFOs) * (0100 0010 0001) % ( ) %b (block special files) %c (character special files) r (0400) w (0200) x (0100) A (0040) I (0020) E (0010) R (0004) W (0002) X (0001) s setuid (04000) S setgid (02000) t sticky bit (01000) fspec spec. spec () `=' `+' `-' . `=' . `=' (file-modes) `+' `-' . `?' `=' . `f' (`[' `{' `<' `]' `}' `>' ) sub-spec . sub-spec `u' `g' `o' `a' `=' `+' `-' `r' `w' `x' `s' `t' . . `u' `g' `o' `a' . `=' `+' `-' . : `r' `w' `x' ( ) `s' setuid setgid `t' (sticky bit)..PP `*(f70?)' . `*(f-100)' `*(f:gu+w,o-rx:)' . estring +cmd string . ( ). `e' string `[' `{' `<' `]' `}' `>' . string globbing . string . globqual zsh_eval_context . string REPLY . reply REPLY (override) . . `lonely' . `*(e:'reply=(${REPLY}{1,2})':)' `lonely1' `lonely2' . string . +cmd cmd . cmd + - (underscore) . cmd . nt() { [[ $REPLY -nt $NTREF ]] } NTREF=reffile ls -ld -- *(+nt) reffile ( ) . ddev dev l[-|+]ct ct (-) ct (+) ct U (effective user ID) G (effective group ID) uid id . id : `u' . `[' `{' `<' `]' `}' `>' . . `u:foo:' `u[foo]' `foo' . gid uid a[Mwhms][-|+]n n . n n (-n) . n n (+n) . `M' `w' `h' `m' `s' ( `ah5') ( ) . `d' . . `echo *(ah-5)' `echo *(ah+5)' . m[Mwhms][-|+]n (modification time) . c[Mwhms][-|+]n (inode change time) . L[+|-]n n (-) n (+) n . `k' (`K') `m' (`M') `p' (`P') ( `Lk-50') ( ) . ( `g' `G' `t' `T' .) <<>> . `*(Lm1)' ( ) . << >> `*(Lm-1)' . ^ () - ( ) ( ) `stat' ( ) M MARK_DIRS T LIST_TYPES ( M ) N NULL_GLOB D GLOB_DOTS n NUMERIC_GLOB_SORT Yn - (short-circuit) : n . n n . oc oN . oc . c : n . L () . l ..TP a . m . c inode . d : -- <> . N . estring +cmd ( ). ^ - <<*(^-oL)>> . oN . n ( ) glob Y N () . oe o+ glob e glob + ( ). REPLY globsort zsh_eval_context . REPLY . . oe o+ glob . Oc <> <<*(^oc)>> <<*(Oc)>> <<*(^Oc)>> <<*(oc)>> <> . [beg[,end]] . . beg end . . : <<*(-OL[1,3])>> . Pstring string glob . string glob e . glob . <<*(P:-f:)>> <<-f file1 -f file2 ...>> . ^ string () . glob <<*(P:foo:^P:bar:^P:baz:)>> <> . . ( <<>> <<>> ). . <> <> <> <> <> <> <> (<<[...]>>) . <<:>> ( <> <> ). <<:>> . . <<(:...)>> NULL_GLOB . : ls -ld -- *(-/) ls -ld -- *(-@) ls -ld -- *(%W) ls -ld -- *(W,X) print -rC1 /tmp/foo*(u0^@:t) (basename) root <> /tmp ls -ld -- *.*~(lex|parse).[ch](^D^l1) ( GLOB_DOTS ) lex.c lex.h parse.c parse.h . print -rC1 b*.pro(#q:s/pro/shmo/)(#q.:s/builtin/shmiltin/) . <<.>> . EXTENDED_GLOB builtin.pro <> . zsh 5.9.2 July 12, 2026 ZSHEXPN(1)