Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
Cactus

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Glossary
MoreInfo
Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
FAQ
Copyright Info
Terms of Use
Privacy Info
Disclaimer
WorkBoard
Thanks
Donations
Advertising
Masthead / Impressum
Your Account

Communication
Feedback
Forums
Private Messages
Surveys

Features
HOWTOs
News Archive
Submit News
Topics
User Articles
Web Links

Google
Google


The Web
linux-tutorial.info

Who's Online
There are currently, 54 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

  

zshexpn



DESCRIPTION

       The  following  types  of  expansions are performed in the
       indicated order in five steps:

       History Expansion
              This is performed only in interactive shells.

       Alias Expansion
              Aliases are expanded immediately before the command
              line  is parsed as explained under Aliasing in zsh­
              misc(1).

       Process Substitution
       Parameter Expansion
       Command Substitution
       Arithmetic Expansion
       Brace Expansion
              These  five  are   performed   in   one   step   in
              left-to-right fashion.  After these expansions, all
              unquoted occurrences of the characters `\', `'' and
              `"' are removed.

       Filename Expansion
              If  the  SH_FILE_EXPANSION option is set, the order
              of expansion is modified for compatibility with  sh
              and  ksh.   In that case filename expansion is per­
              formed immediately after alias expansion, preceding
              the set of five expansions mentioned above.

       Filename Generation
              This  expansion,  commonly referred to as globbing,
              is always done last.

       The following sections explain the types of  expansion  in
       detail.


HISTORY EXPANSION

       History  expansion  allows  you to use words from previous
       command lines in the command line you  are  typing.   This
       simplifies spelling corrections and the repetition of com­
       plicated commands or arguments.  Immediately before execu­
       tion,  each command is saved in the history list, the size
       of which is controlled by the HISTSIZE parameter.  The one
       most  recent command is always retained in any case.  Each
       saved command in the history  list  is  called  a  history
       event  and  is  assigned  a number, beginning with 1 (one)
       when the shell starts up.  The history number that you may
       see in your prompt (see Prompt Expansion in zshmisc(1)) is
       the number that is to be assigned to the next command.

       being expanded, but before any other expansions take place
       and before the command is executed.  It is  this  expanded
       form  that is recorded as the history event for later ref­
       erences.

       By default, a history reference with no  event  designator
       refers  to  the same event as any preceding history refer­
       ence on that command line; if it is the only history  ref­
       erence  in  a  command, it refers to the previous command.
       However, if the option  CSH_JUNKIE_HISTORY  is  set,  then
       every history reference with no event specification always
       refers to the previous command.

       For example, `!' is the event designator for the  previous
       command,  so `!!:1' always refers to the first word of the
       previous command, and `!!$' always refers to the last word
       of  the  previous  command.   With CSH_JUNKIE_HISTORY set,
       then `!:1' and `!$' function in the same manner as  `!!:1'
       and  `!!$',  respectively.  Conversely, if CSH_JUNKIE_HIS­
       TORY is unset, then `!:1' and `!$' refer to the first  and
       last  words, respectively, of the same event referenced by
       the nearest other history reference preceding them on  the
       current  command line, or to the previous command if there
       is no preceding reference.

       The character sequence `^foo^bar' (where `^'  is  actually
       the  second  character of the histchars parameter) repeats
       the last command, replacing the string foo with bar.  More
       precisely,  the  sequence  `^foo^bar^'  is synonymous with
       `!!:s^foo^bar^', hence other modifiers  (see  the  section
       `Modifiers') may follow the final `^'.

       If  the  shell  encounters the character sequence `!"'  in
       the input, the history mechanism is  temporarily  disabled
       until  the  current list (see zshmisc(1)) is fully parsed.
       The `!"' is removed from the input, and any subsequent `!'
       characters have no special significance.

       A  less convenient but more comprehensible form of command
       history support is provided by the fc builtin.

   Event Designators
       An event designator is a reference to a command-line entry
       in the history list.  In the list below, remember that the
       initial `!' in each item may be changed to another charac­
       ter by setting the histchars parameter.

       !      Start  a history expansion, except when followed by
              a blank, newline, `=' or `('.  If followed  immedi­
              ately  by  a word designator (see the section `Word
              Designators'), this forms a history reference  with
              no event designator (see the section `Overview').
              text that is not to be considered part of str.

       !#     Refer to the current command line typed in so  far.
              The  line  is  treated as if it were complete up to
              and including the word before the one with the `!#'
              reference.

       !{...} Insulate  a history reference from adjacent charac­
              ters (if necessary).

   Word Designators
       A word designator indicates which word or words of a given
       command line are to be included in a history reference.  A
       `:' usually separates the  event  specification  from  the
       word  designator.  It may be omitted only if the word des­
       ignator begins with a `^', `$', `*',  `-'  or  `%'.   Word
       designators include:

       0      The first input word (command).
       n      The nth argument.
       ^      The first argument.  That is, 1.
       $      The last argument.
       %      The  word matched by (the most recent) ?str search.
       x-y    A range of words; x defaults to 0.
       *      All the arguments, or a null  value  if  there  are
              none.
       x*     Abbreviates `x-$'.
       x-     Like `x*' but omitting word $.

       Note  that  a  `%' word designator works only when used in
       one of `!%', `!:%' or `!?str?:%', and only when used after
       a !? expansion (possibly in an earlier command).  Anything
       else results in an error, although the error  may  not  be
       the most obvious one.

   Modifiers
       After the optional word designator, you can add a sequence
       of one or more of the following modifiers,  each  preceded
       by  a  `:'.   These  modifiers  also work on the result of
       filename generation and parameter expansion, except  where
       noted.

       h      Remove  a  trailing pathname component, leaving the
              head.  This works like `dirname'.

       r      Remove a filename extension  of  the  form  `.xxx',
              leaving the root name.

       e      Remove all but the extension.

       t      Remove all leading pathname components, leaving the
              tail.  This works like `basename'.
              not work with parameter expansion.

       l      Convert the words to all lowercase.

       u      Convert the words to all uppercase.

       s/l/r[/]
              Substitute r for l as described below.  Unless pre­
              ceded immediately by a g, with  no  colon  between,
              the  substitution is done only for the first string
              that matches l.  For arrays and for filename gener­
              ation,  this  applies  to each word of the expanded
              text.

       &      Repeat the previous s substitution.  Like s, may be
              preceded  immediately  by a g.  In parameter expan­
              sion the & must appear inside braces, and in  file­
              name generation it must be quoted with a backslash.

       The s/l/r/ substitution works as follows.   The  left-hand
       side  of  substitutions  are  not regular expressions, but
       character strings.  Any  character  can  be  used  as  the
       delimiter  in place of `/'.  A backslash quotes the delim­
       iter character.  The character `&', in the right-hand-side
       r, is replaced by the text from the left-hand-side l.  The
       `&' can be quoted with a backslash.  A  null  l  uses  the
       previous  string  either  from  the previous l or from the
       contextual scan string s from `!?s'.   You  can  omit  the
       rightmost  delimiter  if  a newline immediately follows r;
       the rightmost `?' in a context scan can similarly be omit­
       ted.   Note  the  same record of the last l and r is main­
       tained across all forms of expansion.

       The following f, F, w  and  W  modifiers  work  only  with
       parameter  expansion  and  filename  generation.  They are
       listed here to provide a single point of reference for all
       modifiers.

       f      Repeats the immediately (without a colon) following
              modifier until the resulting  word  doesn't  change
              any more.

       F:expr:
              Like  f, but repeats only n times if the expression
              expr evaluates to n.  Any  character  can  be  used
              instead  of the `:'; if `(', `[', or `{' is used as
              the opening delimiter, the closing delimiter should
              be ')', `]', or `}', respectively.

       w      Makes  the  immediately  following modifier work on
              each word in the string.

       on this special file will provide input for list.  If < is
       used, then the file passed as an  argument  will  be  con­
       nected to the output of the list process.  For example,

              paste <(cut -f1 file1) <(cut -f3 file2) |
              tee >(process1) >(process2) >/dev/null

       cuts fields 1 and 3 from the files file1 and file2 respec­
       tively, pastes the results together, and sends it  to  the
       processes process1 and process2.

       If  =(...) is used instead of <(...), then the file passed
       as an argument will be the name of a temporary  file  con­
       taining  the output of the list process.  This may be used
       instead of the < form for a program that expects to  lseek
       (see lseek(2)) on the input file.

       The  =  form  is  useful as both the /dev/fd and the named
       pipe implementation of <(...) have drawbacks.  In the for­
       mer case, some programmes may automatically close the file
       descriptor in question before examining the  file  on  the
       command  line, particularly if this is necessary for secu­
       rity reasons such as when the programme is running setuid.
       In  the  second  case,  if the programme does not actually
       open the file, the subshell attempting  to  read  from  or
       write  to the pipe will (in a typical implementation, dif­
       ferent operating systems  may  have  different  behaviour)
       block  for ever and have to be killed explicitly.  In both
       cases, the shell actually supplies the information using a
       pipe,  so  that  programmes  that  expect  to  lseek  (see
       lseek(2)) on the file will not work.

       Also note that the previous example can be more  compactly
       and  efficiently  written  (provided the MULTIOS option is
       set) as:

              paste <(cut -f1 file1) <(cut -f3 file2) \
              > >(process1) > >(process2)

       The shell uses pipes instead of  FIFOs  to  implement  the
       latter two process substitutions in the above example.

       There  is an additional problem with >(process); when this
       is attached to an external command, the parent shell  does
       not  wait  for  process to finish and hence an immediately
       following command cannot rely on the  results  being  com­
       plete.  The problem and solution are the same as described
       in the section MULTIOS in zshmisc(1).  Hence in a  simpli­
       fied version of the example above:

              paste <(cut -f1 file1) <(cut -f3 file2) > >(process)


       Note in particular the fact that words of unquoted parame­
       ters  are not automatically split on whitespace unless the
       option SH_WORD_SPLIT is set; see references to this option
       below  for  more details.  This is an important difference
       from other shells.

       In the expansions discussed below that require a  pattern,
       the form of the pattern is the same as that used for file­
       name generation; see the  section  `Filename  Generation'.
       Note  that these patterns, along with the replacement text
       of any substitutions, are themselves subject to  parameter
       expansion, command substitution, and arithmetic expansion.
       In addition to the following operations, the  colon  modi­
       fiers  described in the section `Modifiers' in the section
       `History  Expansion'  can  be   applied:    for   example,
       ${i:s/foo/bar/} performs string substitution on the expan­
       sion of parameter $i.

       ${name}
              The value, if any, of the parameter name is substi­
              tuted.  The braces are required if the expansion is
              to be followed by a letter,  digit,  or  underscore
              that  is not to be interpreted as part of name.  In
              addition, more complicated  forms  of  substitution
              usually  require  the  braces to be present; excep­
              tions, which only apply if the option KSH_ARRAYS is
              not  set, are a single subscript or any colon modi­
              fiers appearing after the name, or any of the char­
              acters  `^',  `=', `~', `#' or `+' appearing before
              the name, all of which work with or without braces.

              If  name  is an array parameter, and the KSH_ARRAYS
              option is not set, then the value of  each  element
              of name is substituted, one element per word.  Oth­
              erwise, the expansion results  in  one  word  only;
              with  KSH_ARRAYS,  this  is the first element of an
              array.  No field splitting is done  on  the  result
              unless the SH_WORD_SPLIT option is set.

       ${+name}
              If  name is the name of a set parameter `1' is sub­
              stituted, otherwise `0' is substituted.

       ${name:-word}
              If name is set and is non-null then substitute  its
              value;  otherwise substitute word. If name is miss­
              ing, substitute word.

       ${name:=word}
       ${name::=word}
              In the first form, if name is unset or is null then

       If the colon is omitted from one of the above  expressions
       containing  a  colon,  then  the shell only checks whether
       name is set, not whether its value is null.

       In the following expressions, when name is  an  array  and
       the  substitution  is  not quoted, or if the `(@)' flag or
       the name[@] syntax is used, matching  and  replacement  is
       performed on each array element separately.

       ${name#pattern}
       ${name##pattern}
              If  the  pattern matches the beginning of the value
              of name, then substitute the value of name with the
              matched portion deleted; otherwise, just substitute
              the value of name.  In the first form, the smallest
              matching  pattern is preferred; in the second form,
              the largest matching pattern is preferred.

       ${name%pattern}
       ${name%%pattern}
              If the pattern matches the  end  of  the  value  of
              name,  then  substitute  the value of name with the
              matched portion deleted; otherwise, just substitute
              the value of name.  In the first form, the smallest
              matching pattern is preferred; in the second  form,
              the largest matching pattern is preferred.

       ${name:#pattern}
              If the pattern matches the value of name, then sub­
              stitute the empty string; otherwise,  just  substi­
              tute  the  value  of name.  If name is an array the
              matching array elements are removed (use the  `(M)'
              flag to remove the non-matched elements).

       ${name/pattern/repl}
       ${name//pattern/repl}
              Replace  the  longest  possible match of pattern in
              the expansion of parameter  name  by  string  repl.
              The  first form replaces just the first occurrence,
              the second form all occurrences.  Both pattern  and
              repl  are subject to double-quoted substitution, so
              that  expressions  like  ${name/$opat/$npat}   will
              work,  but note the usual rule that pattern charac­
              ters in $opat  are  not  treated  specially  unless
              either  the  option  GLOB_SUBST is set, or $opat is
              instead substituted as ${~opat}.

              The pattern may begin with a `#', in which case the
              pattern  must  match at the start of the string, or
              `%', in which case it must match at the end of  the
              string.   The repl may be an empty string, in which
              For example,

                     foo="twinkle twinkle little star" sub="t*e" rep="spy"
                     print ${foo//${~sub}/$rep}
                     print ${(S)foo//${~sub}/$rep}

              Here, the `~' ensures that  the  text  of  $sub  is
              treated  as  a  pattern rather than a plain string.
              In the first case, the longest  match  for  t*e  is
              substituted  and the result is `spy star', while in
              the second case, the shortest matches are taken and
              the result is `spy spy lispy star'.

       ${#spec}
              If  spec is one of the above substitutions, substi­
              tute the length in characters of the result instead
              of  the result itself.  If spec is an array expres­
              sion, substitute the  number  of  elements  of  the
              result.   Note  that `^', `=', and `~', below, must
              appear to the left of `#' when these forms are com­
              bined.

       ${^spec}
              Turn  on the RC_EXPAND_PARAM option for the evalua­
              tion of spec; if the `^' is doubled, turn  it  off.
              When  this  option  is set, array expansions of the
              form foo${xx}bar, where the parameter xx is set  to
              (a  b  c),  are  substituted  with `fooabar foobbar
              foocbar' instead of the default `fooa b cbar'.

              Internally, each such expansion is  converted  into
              the  equivalent  list  for  brace expansion.  E.g.,
              ${^var} becomes {$var[1],$var[2],...}, and is  pro­
              cessed  as  described  in the section `Brace Expan­
              sion' below.  If word splitting is also  in  effect
              the  $var[N] may themselves be split into different
              list elements.

       ${=spec}
              Perform  word  splitting  using   the   rules   for
              SH_WORD_SPLIT  during  the  evaluation of spec, but
              regardless of whether the parameter appears in dou­
              ble  quotes;  if  the  `=' is doubled, turn it off.
              This forces parameter expansions to be  split  into
              separate  words before substitution, using IFS as a
              delimiter.  This is done by default in  most  other
              shells.

              Note  that  splitting  is  applied  to  word in the
              assignment forms of spec before the  assignment  to
              name  is  performed.   This  affects  the result of
              array assignments with the A flag.

       value of name.  Thus it  is  possible  to  perform  nested
       operations:   ${${foo#head}%tail} substitutes the value of
       $foo with both `head' and `tail' deleted.  The  form  with
       $(...)  is  often  useful  in  combination  with the flags
       described next; see the  examples  below.   Each  name  or
       nested  ${...}  in  a parameter expansion may also be fol­
       lowed by a subscript  expression  as  described  in  Array
       Parameters in zshparam(1).

       Note  that  double quotes may appear around nested expres­
       sions, in which case only the part inside  is  treated  as
       quoted;  for  example, ${(f)"$(foo)"} quotes the result of
       $(foo), but the flag `(f)' (see below)  is  applied  using
       the  rules  for  unquoted  expansions.   Note further that
       quotes are themselves nested in this context; for example,
       in  "${(@f)"$(foo)"}",  there  are two sets of quotes, one
       surrounding the whole expression,  the  other  (redundant)
       surrounding the $(foo) as before.

   Parameter Expansion Flags
       If  the  opening  brace is directly followed by an opening
       parenthesis, the string up to the matching closing  paren­
       thesis  will  be taken as a list of flags.  In cases where
       repeating a flag is meaningful, the repetitions  need  not
       be  consecutive;  for  example,  `(q%q%q)'  means the same
       thing as the more readable `(%%qqq)'.  The following flags
       are supported:

       %      Expand  all % escapes in the resulting words in the
              same way as in in prompts (see the section  `Prompt
              Expansion').  If  this  flag  is  given twice, full
              prompt expansion is done on  the  resulting  words,
              depending  on  the  setting  of the PROMPT_PERCENT,
              PROMPT_SUBST and PROMPT_BANG options.

       @      In double quotes, array elements are put into sepa­
              rate  words.   E.g., `"${(@)foo}"' is equivalent to
              `"${foo[@]}"' and `"${(@)foo[1,2]}"' is the same as
              `"$foo[1]" "$foo[2]"'.  This is distinct from field
              splitting by the the f, s or z flags,  which  still
              applies within each array element.

       A      Create   an   array  parameter  with  `${...=...}',
              `${...:=...}' or `${...::=...}'.  If this  flag  is
              repeated  (as in `AA'), create an associative array
              parameter.  Assignment is made  before  sorting  or
              padding.   The name part may be a subscripted range
              for ordinary arrays; the word  part  must  be  con­
              verted   to   an   array,   for  example  by  using
              `${(AA)=name=...}'  to  activate  field  splitting,
              when creating an associative array.

       e      Perform  parameter  expansion, command substitution
              and arithmetic expansion on the result. Such expan­
              sions can be nested but too deep recursion may have
              unpredictable effects.

       f      Split the result of the expansion to lines. This is
              a shorthand for `ps:\n:'.

       F      Join  the words of arrays together using newline as
              a separator.  This is a shorthand for `pj:\n:'.

       i      With o or O, sort case-independently.

       k      If name refers to an associative array,  substitute
              the  keys (element names) rather than the values of
              the  elements.   Used  with  subscripts  (including
              ordinary  arrays), force indices or keys to be sub­
              stituted even if the subscript form refers to  val­
              ues.   However,  this flag may not be combined with
              subscript ranges.

       L      Convert all letters in the result to lower case.

       n      With o or O, sort numerically.

       o      Sort the resulting words in ascending order.

       O      Sort the resulting words in descending order.

       P      This forces the value of the parameter name  to  be
              interpreted  as  a  further  parameter  name, whose
              value will be used where appropriate. If used  with
              a  nested  parameter  or  command substitution, the
              result of that will be taken as a parameter name in
              the  same  way.  For example, if you have `foo=bar'
              and `bar=baz', the strings ${(P)foo}, ${(P)${foo}},
              and ${(P)$(echo bar)} will be expanded to `baz'.

       q      Quote the resulting words with backslashes. If this
              flag is given twice, the resulting words are quoted
              in  single  quotes  and if it is given three times,
              the words are quoted in double  quotes.  If  it  is
              given  four  times,  the words are quoted in single
              quotes preceded by a $.

       Q      Remove one  level  of  quotes  from  the  resulting
              words.

       t      Use  a  string describing the type of the parameter
              where the value  of  the  parameter  would  usually
              appear.  This string consists of keywords separated
                     for right justified parameters with  leading
                     zeros

              lower  for  parameters  whose value is converted to
                     all lower case when it is expanded

              upper  for parameters whose value is  converted  to
                     all upper case when it is expanded

              readonly
                     for readonly parameters

              tag    for tagged parameters

              export for exported parameters

              unique for  arrays which keep only the first occur­
                     rence of duplicated values

              hide   for parameters with the `hide' flag

              special
                     for special parameters defined by the shell

       u      Expand only the first  occurrence  of  each  unique
              word.

       U      Convert all letters in the result to upper case.

       v      Used  with k, substitute (as two consecutive words)
              both the key and  the  value  of  each  associative
              array  element.  Used with subscripts, force values
              to be substituted even if the subscript form refers
              to indices or keys.

       V      Make  any special characters in the resulting words
              visible.

       w      With ${#name}, count words in  arrays  or  strings;
              the s flag may be used to set a word delimiter.

       W      Similar  to  w with the difference that empty words
              between repeated delimiters are also counted.

       X      With this flag parsing errors occurring with the  Q
              and  e  flags or the pattern matching forms such as
              `${name#pattern}' are reported.  Without  the  flag
              they are silently ignored.

       z      Split  the result of the expansion into words using
              shell parsing to find the words, i.e.  taking  into
              account any quoting in the value.

       p      Recognize  the  same  escape sequences as the print
              builtin in string arguments to  any  of  the  flags
              described below.

       j:string:
              Join the words of arrays together using string as a
              separator.  Note  that  this  occurs  before  field
              splitting by the SH_WORD_SPLIT option.

       l:expr::string1::string2:
              Pad  the  resulting  words  on the left.  Each word
              will be truncated if required and placed in a field
              expr  characters  wide.  The space to the left will
              be filled with string1 (concatenated  as  often  as
              needed) or spaces if string1 is not given.  If both
              string1 and  string2  are  given,  this  string  is
              inserted  once  directly  to the left of each word,
              before padding.

       r:expr::string1::string2:
              As l, but pad the words on  the  right  and  insert
              string2 on the right.

       s:string:
              Force    field    splitting    (see    the   option
              SH_WORD_SPLIT) at the separator string.  Note  that
              a  string  of two or more characters means all must
              all match in sequence; this differs from the treat­
              ment  of  two or more characters in the IFS parame­
              ter.

       The following flags are meaningful with the ${...#...}  or
       ${...%...} forms.  The S and I flags may also be used with
       the ${.../...} forms.

       S      Search substrings as well as  beginnings  or  ends;
              with  #  start  from the beginning and with % start
              from the end of the string.  With substitution  via
              ${.../...}  or  ${...//...},  specifies  non-greedy
              matching, i.e. that the  shortest  instead  of  the
              longest match should be replaced.

       I:expr:
              Search  the exprth match (where expr evaluates to a
              number).  This only applies when searching for sub­
              strings, either with the S flag, or with ${.../...}
              (only  the  exprth   match   is   substituted)   or
              ${...//...}  (all  matches  from  the exprth on are
              substituted).  The default is  to  take  the  first
              match.

              `witch',  `witch'  and  `wich'; the form using `##'
              will match and remove `which switch  is  the  right
              switch for Ipswich', `witch is the right switch for
              Ipswich', `witch for Ipswich' and `wich'. The  form
              using  `%' will remove the same matches as for `#',
              but in reverse order, and the form using `%%'  will
              remove  the  same  matches  as  for `##' in reverse
              order.

       B      Include the index of the beginning of the match  in
              the result.

       E      Include  the  index  of the end of the match in the
              result.

       M      Include the matched portion in the result.

       N      Include the length of the match in the result.

       R      Include the unmatched portion in  the  result  (the
              Rest).

   Rules
       Here  is  a  summary  of  the rules for substitution; this
       assumes that braces are present around  the  substitution,
       i.e.  ${...}.   Some  particular examples are given below.
       Note that the Zsh Development Group accepts  no  responsi­
       bility  for  any  brain  damage which may occur during the
       reading of the following rules.

       1. Nested Substitution
              If multiple nested ${...} forms are  present,  sub­
              stitution  is  performed  from the inside outwards.
              At each level, the substitution  takes  account  of
              whether  the current value is a scalar or an array,
              whether the whole substitution is in double quotes,
              and what flags are supplied to the current level of
              substitution, just as if  the  nested  substitution
              were  the  outermost.  The flags are not propagated
              up to enclosing substitutions; the nested substitu­
              tion  will  return  either  a scalar or an array as
              determined by  the  flags,  possibly  adjusted  for
              quoting.   All the following steps take place where
              applicable at all  levels  of  substitution.   Note
              that,  unless  the `(P)' flag is present, the flags
              and any subscripts apply directly to the  value  of
              the nested substitution; for example, the expansion
              ${${foo}} behaves exactly the same as ${foo}.

       2. Parameter Subscripting
              If the value is a raw parameter  reference  with  a
              corresponding value, is applied.

       4. Double-Quoted Joining
              If the value after this process is  an  array,  and
              the  substitution  appears in double quotes, and no
              (@) flag is present at the current level, the words
              of the value are joined with the first character of
              the parameter $IFS, by  default  a  space,  between
              each  word  (single  word arrays are not modified).
              If the (j) flag is present, that is used for  join­
              ing instead of $IFS.

       5. Nested Subscripting
              Any  remaining subscripts (i.e. of a nested substi­
              tution) are  evaluated  at  this  point,  based  on
              whether the value is an array or a scalar.  As with
              2., multiple  subscripts  can  appear.   Note  that
              ${foo[2,4][2]}     is     thus     equivalent    to
              ${${foo[2,4]}[2]}        and        also         to
              "${${(@)foo[2,4]}[2]}"   (the  nested  substitution
              returns  an  array  in  both  cases),  but  not  to
              "${${foo[2,4]}[2]}"    (the   nested   substitution
              returns a scalar because of the quotes).

       6. Modifiers
              Any modifiers, as specified by a trailing `#', `%',
              `/'  (possibly doubled) or by a set of modifiers of
              the form :... (see the section `Modifiers'  in  the
              section  `History  Expansion'),  are applied to the
              words of the value at this level.

       7. Forced Joining
              If the `(j)' flag is present, or no `(j)'  flag  is
              present  but  the string is to be split as given by
              rules 8. or 9., and joining did not take  place  at
              step 4., any words in the value are joined together
              using the given string or the  first  character  of
              $IFS  if none.  Note that the `(F)' flag implicitly
              supplies a string for joining in this manner.

       8. Forced Splitting
              If one of the `(s)', `(f)' or `(z)' flags are  pre­
              sent,  or  the  `='  specifier  was  present  (e.g.
              ${=var}), the word is split on occurrences  of  the
              specified string, or (for = with neither of the two
              flags present) any of the characters in $IFS.

       9. Shell Word Splitting
              If no `(s)', `(f)' or `=' was given, but  the  word
              is  not quoted and the option SH_WORD_SPLIT is set,
              the word is split on  occurrences  of  any  of  the
              characters  in  $IFS.   Note  this step, too, takes
              the  first  character  of  IFS  between.    So   in
              `${(P)${(f)lines}}'  the value of ${lines} is split
              at newlines, but then must be joined  again  before
              the P flag can be applied.

              If  a  single  word  is  not required, this rule is
              skipped.

   Examples
       The flag f is useful to split a double-quoted substitution
       line  by  line.  For example, ${(f)"$(<file)"} substitutes
       the contents of file divided so that each line is an  ele­
       ment of the resulting array.  Compare this with the effect
       of $(<file) alone, which divides the file up by words,  or
       the same inside double quotes, which makes the entire con­
       tent of the file a single string.

       The following illustrates the rules for  nested  parameter
       expansions.   Suppose  that  $foo  contains the array (bar
       baz):

       "${(@)${foo}[1]}"
              This produces the result b.  First, the inner  sub­
              stitution  "${foo}",  which  has no array (@) flag,
              produces a single word result "bar baz".  The outer
              substitution  "${(@)...[1]}" detects that this is a
              scalar, so that (despite the `(@)' flag)  the  sub­
              script picks the first character.

       "${${(@)foo}[1]}"
              This  produces the result `bar'.  In this case, the
              inner substitution "${(@)foo}" produces  the  array
              `(bar  baz)'.   The  outer substitution "${...[1]}"
              detects that this is an array and picks  the  first
              word.    This   is   similar  to  the  simple  case
              "${foo[1]}".

       As an example of the rules for word splitting and joining,
       suppose $foo contains the array `(ax1 bx1)'.  Then

       ${(s/x/)foo}
              produces the words `a', `1 b' and `1'.

       ${(j/x/s/x/)foo}
              produces `a', `1', `b' and `1'.

       ${(s/x/)foo%%1*}
              produces  `a'  and ` b' (note the extra space).  As
              substitution occurs before either joining or split­
              ting,  the  operation  first generates the modified
              array (ax bx), which is joined to give "ax bx", and

       put is eligible for filename generation.


ARITHMETIC EXPANSION

       A string of the form `$[exp]' or `$((exp))' is substituted
       with the value of the arithmetic expression exp.   exp  is
       subjected to parameter expansion, command substitution and
       arithmetic expansion before it is evaluated.  See the sec­
       tion `Arithmetic Evaluation'.


BRACE EXPANSION

       A string of the form `foo{xx,yy,zz}bar' is expanded to the
       individual words `fooxxbar',  `fooyybar'  and  `foozzbar'.
       Left-to-right  order  is preserved.  This construct may be
       nested.  Commas may be quoted in  order  to  include  them
       literally in a word.

       An  expression of the form `{n1..n2}', where n1 and n2 are
       integers, is expanded to every number between  n1  and  n2
       inclusive.   If  either number begins with a zero, all the
       resulting numbers will be padded with  leading  zeroes  to
       that  minimum  width.   If  the  numbers are in decreasing
       order the resulting sequence will also  be  in  decreasing
       order.

       If  a brace expression matches none of the above forms, it
       is left unchanged, unless the BRACE_CCL option is set.  In
       that case, it is expanded to a sorted list of the individ­
       ual characters between the braces,  in  the  manner  of  a
       search  set.  `-' is treated specially as in a search set,
       but `^' or `!' as the first character is treated normally.

       Note  that brace expansion is not part of filename genera­
       tion (globbing); an  expression  such  as  */{foo,bar}  is
       split into two separate words */foo and */bar before file­
       name generation takes place.   In  particular,  note  that
       this  is liable to produce a `no match' error if either of
       the two expressions does not match; this  is  to  be  con­
       trasted  with  */(foo|bar),  which  is treated as a single
       pattern but otherwise has similar effects.


FILENAME EXPANSION

       Each word is checked to see if it begins with an  unquoted
       `~'.  If it does, then the word up to a `/', or the end of
       the word if there is no `/', is checked to see if  it  can
       be  substituted in one of the ways described here.  If so,
       then the `~' and the checked portion are replaced with the
       appropriate substitute value.

       A  `~' by itself is replaced by the value of $HOME.  A `~'
       followed by a `+' or a `-' is replaced  by  the  value  of
       $PWD or $OLDPWD, respectively.

       home  directories  for users on the system.  They may also
       be defined if the text after the `~'  is  the  name  of  a
       string  shell parameter whose value begins with a `/'.  It
       is also possible to define directory names  using  the  -d
       option to the hash builtin.

       In  certain circumstances (in prompts, for instance), when
       the shell prints a path, the path is checked to see if  it
       has a named directory as its prefix.  If so, then the pre­
       fix portion is replaced with a `~' followed by the name of
       the  directory.   The  shortest  way  of  referring to the
       directory is used, with ties broken in favour of  using  a
       named  directory,  except  when the directory is / itself.
       The parameters $PWD and $OLDPWD are never  abbreviated  in
       this fashion.

       If  a  word  begins  with  an  unquoted `=' and the EQUALS
       option is set, the remainder of the word is taken  as  the
       name  of a command.  If a command exists by that name, the
       word is replaced by the full pathname of the command.

       Filename expansion is performed on the right hand side  of
       a  parameter  assignment,  including those appearing after
       commands of the typeset family.  In this case,  the  right
       hand side will be treated as a colon-separated list in the
       manner of the PATH parameter, so that a `~' or an `=' fol­
       lowing   a  `:'  is  eligible  for  expansion.   All  such
       behaviour can be disabled by quoting the `~', the `=',  or
       the  whole  expression  (but  not  simply  the colon); the
       EQUALS option is also respected.

       If the option MAGIC_EQUAL_SUBST is set, any unquoted shell
       argument  in the form `identifier=expression' becomes eli­
       gible for file expansion  as  described  in  the  previous
       paragraph.  Quoting the first `=' also inhibits this.


FILENAME GENERATION

       If  a  word  contains  an  unquoted instance of one of the
       characters `*', `(', `|', `<', `[', or `?', it is regarded
       as  a  pattern  for  filename  generation, unless the GLOB
       option is unset.  If the EXTENDED_GLOB option is set,  the
       `^'  and  `#'  characters also denote a pattern; otherwise
       they are not treated specially by the shell.

       The word is replaced with a list of sorted filenames  that
       match  the  pattern.  If no matching pattern is found, the
       shell gives an error message, unless the NULL_GLOB  option
       is  set,  in which case the word is deleted; or unless the
       NOMATCH option is unset, in which case the  word  is  left
       unchanged.

       In  filename generation, the character `/' must be matched
              including it as the first character  in  the  list.
              There are also several named classes of characters,
              in the form `[:name:]' with the following meanings:
              `[:alnum:]'  alphanumeric,  `[:alpha:]' alphabetic,
              `[:ascii:]'  7-bit,  `[:blank:]'  space   or   tab,
              `[:cntrl:]'  control character, `[:digit:]' decimal
              digit,  `[:graph:]'  printable   character   except
              whitespace,     `[:lower:]'    lowercase    letter,
              `[:print:]' printable character, `[:punct:]' print­
              able character neither alphanumeric nor whitespace,
              `[:space:]'   whitespace   character,   `[:upper:]'
              uppercase  letter,  `[:xdigit:]' hexadecimal digit.
              These use the macros provided by the operating sys­
              tem  to  test for the given character combinations,
              including any modifications due to  local  language
              settings:   see  ctype(3).   Note  that  the square
              brackets are  additional  to  those  enclosing  the
              whole  set  of  characters, so to test for a single
              alphanumeric  character  you  need   `[[:alnum:]]'.
              Named  character  sets  can be used alongside other
              types, e.g. `[[:alpha:]0-9]'.

       [^...]
       [!...] Like [...], except that it  matches  any  character
              which is not in the given set.

       <[x]-[y]>
              Matches  any number in the range x to y, inclusive.
              Either of the numbers may be omitted  to  make  the
              range  open-ended;  hence `<->' matches any number.
              To match individual digits, the [...] form is  more
              efficient.

              Be  careful  when using other wildcards adjacent to
              patterns of this form;  for  example,  <0-9>*  will
              actually  match  any number whatsoever at the start
              of the string, since the  `<0-9>'  will  match  the
              first  digit,  and  the  `*' will match any others.
              This is a trap for the unwary, but is  in  fact  an
              inevitable consequence of the rule that the longest
              possible match always succeeds.   Expressions  such
              as `<0-9>[^[:digit:]]*' can be used instead.

       (...)  Matches  the  enclosed  pattern.   This is used for
              grouping.  If the KSH_GLOB option is  set,  then  a
              `@', `*', `+', `?' or `!' immediately preceding the
              `(' is treated specially, as  detailed  below.  The
              option SH_GLOB prevents bare parentheses from being
              used in this way, though  the  KSH_GLOB  option  is
              still available.

              Note  that  grouping  cannot  extend  over multiple
              thing except the pattern  x.   This  has  a  higher
              precedence  than  `/',  so  `^foo/bar'  will search
              directories in `.' except `./foo' for a file  named
              `bar'.

       x~y    (Requires EXTENDED_GLOB to be set.)  Match anything
              that matches the pattern x but does  not  match  y.
              This  has lower precedence than any operator except
              `|', so `*/*~foo/bar' will search for all files  in
              all  directories in `.'  and then exclude `foo/bar'
              if there was such a match.  Multiple  patterns  can
              be  excluded  by  `foo~bar~baz'.   In the exclusion
              pattern (y), `/' and `.' are not treated  specially
              the way they usually are in globbing.

       x#     (Requires  EXTENDED_GLOB  to be set.)  Matches zero
              or more occurrences of the pattern x.  This  opera­
              tor  has  high  precedence;  `12#' is equivalent to
              `1(2#)', rather than `(12)#'.  It is an  error  for
              an unquoted `#' to follow something which cannot be
              repeated; this includes an empty string, a  pattern
              already  followed by `##', or parentheses when part
              of a KSH_GLOB pattern (for  example,  `!(foo)#'  is
              invalid and must be replaced by `*(!(foo))').

       x##    (Requires EXTENDED_GLOB to be set.)  Matches one or
              more occurrences of the pattern x.   This  operator
              has   high  precedence;  `12##'  is  equivalent  to
              `1(2##)', rather than `(12)##'.  No more  than  two
              active `#' characters may appear together.

   ksh-like Glob Operators
       If  the KSH_GLOB option is set, the effects of parentheses
       can be modified by a preceding `@', `*', `+', `?' or  `!'.
       This  character  need  not  be  unquoted  to  have special
       effects, but the `(' must be.

       @(...) Match  the  pattern  in  the  parentheses.    (Like
              `(...)'.)

       *(...) Match  any number of occurrences.  (Like `(...)#'.)

       +(...) Match at least one occurrence.  (Like `(...)##'.)

       ?(...) Match zero or one occurrence.  (Like `(|...)'.)

       !(...) Match anything but the expression  in  parentheses.
              (Like `(^(...))'.)

   Precedence
       The  precedence  of the operators given above is (highest)
       `^', `/', `~', `|' (lowest); the remaining  operators  are
       of the pattern; they require the EXTENDED_GLOB option. All
       take  the  form (#X) where X may have one of the following
       forms:

       i      Case insensitive:  upper or lower  case  characters
              in  the  pattern  match upper or lower case charac­
              ters.

       l      Lower case characters in the pattern match upper or
              lower case characters; upper case characters in the
              pattern still only match upper case characters.

       I      Case sensitive:  locally negates the effect of i or
              l from that point on.

       b      Activate backreferences for parenthesised groups in
              the pattern; this does not work in filename genera­
              tion.   When  a pattern with a set of active paren­
              theses is  matched,  the  strings  matched  by  the
              groups  are stored in the array $match, the indices
              of the beginning of the matched parentheses in  the
              array  $mbegin,  and  the indices of the end in the
              array $mend, with the first element of  each  array
              corresponding to the first parenthesised group, and
              so on.  These arrays are not otherwise  special  to
              the  shell.  The indices use the same convention as
              does parameter substitution, so  that  elements  of
              $mend  and  $mbegin  may be used in subscripts; the
              KSH_ARRAYS option is respected.  Sets  of  globbing
              flags are not considered parenthesised groups; only
              the first nine active  parentheses  can  be  refer­
              enced.

              For example,

                     foo="a string with a message"
                     if [[ $foo = (a|an)' '(#b)(*)' '* ]]; then
                       print ${foo[$mbegin[1],$mend[1]]}
                     fi

              prints `string with a'.  Note that the first paren­
              thesis is before the (#b) and  does  not  create  a
              backreference.

              Backreferences  work  with  all  forms  of  pattern
              matching other than filename generation,  but  note
              that  when  performing  matches on an entire array,
              such as ${array#pattern}, or a global substitution,
              such  as  ${param//pat/repl}, only the data for the
              last match  remains  available.   In  the  case  of
              global  replacements this may still be useful.  See
              the example for the m flag below.

              If the  match  fails  none  of  the  parameters  is
              altered,  so  in  some cases it may be necessary to
              initialise them beforehand.  If some of  the  back­
              references  fail to match --- which happens if they
              are in an alternate branch which fails to match, or
              if  they  are  followed by # and matched zero times
              --- then the matched string is  set  to  the  empty
              string,  and  the  start and end indices are set to
              -1.

              Pattern matching with  backreferences  is  slightly
              slower than without.

       B      Deactivate  backreferences,  negating the effect of
              the b flag from that point on.

       m      Set references to the match  data  for  the  entire
              string  matched; this is similar to backreferencing
              and does not work in filename generation.  The flag
              must  be  in effect at the end of the pattern, i.e.
              not local to a group. The parameters $MATCH,  $MBE­
              GIN and $MEND will be set to the string matched and
              to the indices of the  beginning  and  end  of  the
              string,  respectively.   This  is  most  useful  in
              parameter substitutions, as  otherwise  the  string
              matched is obvious.

              For example,

                     arr=(veldt jynx grimps waqf zho buck)
                     print ${arr//(#m)[aeiou]/${(U)MATCH}}

              forces  all  the  matches  (i.e.  all  vowels) into
              uppercase, printing `vEldt  jynx  grImps  wAqf  zhO
              bUck'.

              Unlike  backreferences,  there  is no speed penalty
              for using match references, other  than  the  extra
              substitutions  required for the replacement strings
              in cases such as the example shown.

       M      Deactivate the m flag, hence no references to match
              data will be created.

       anum   Approximate matching: num errors are allowed in the
              string matched by the pattern.  The rules for  this
              are described in the next subsection.

       s, e   Unlike  the  other  flags,  these have only a local
              effect, and each must appear on  its  own:   `(#s)'
              and  `(#e)'  are  the only valid forms.  The `(#s)'
              `A*Z'.  There are other  ways  of  performing  many
              operations of this type, however the combination of
              the substitution operations `/' and `//'  with  the
              `(#s)'  and  `(#e)'  flags provides a single simple
              and memorable method.

              Note that assertions of  the  form  `(^(#s))'  also
              work,  i.e.  match  anywhere except at the start of
              the string, although this actually means  `anything
              except  a  zero-length  portion at the start of the
              string'; you need to use  `(""~(#s))'  to  match  a
              zero-length portion of the string not at the start.

       q      A `q' and everything up to the closing  parenthesis
              of  the  globbing  flags are ignored by the pattern
              matching code.  This is intended to support the use
              of  glob qualifiers, see below.  The result is that
              the pattern `(#b)(*).c(#q.)' can be used  both  for
              globbing and for matching against a string.  In the
              former case, the `(#q.)' will be treated as a  glob
              qualifier  and the `(#b)' will not be useful, while
              in the latter case the `(#b)' is useful  for  back­
              references  and  the `(#q.)' will be ignored.  Note
              that colon modifiers in  the  glob  qualifiers  are
              also not applied in ordinary pattern matching.

       For  example,  the test string fooxx can be matched by the
       pattern (#i)FOOXX, but not by (#l)FOOXX, (#i)FOO(#I)XX  or
       ((#i)FOOX)X.     The    string    (#ia2)readme   specifies
       case-insensitive matching of readme with up to two errors.

       When  using  the ksh syntax for grouping both KSH_GLOB and
       EXTENDED_GLOB must be set and the left parenthesis  should
       be  preceded by @.  Note also that the flags do not affect
       letters inside [...]  groups,  in  other  words  (#i)[a-z]
       still  matches only lowercase letters.  Finally, note that
       when examining whole paths case-insensitively every direc­
       tory must be searched for all files which match, so that a
       pattern of the form (#i)/foo/bar/... is potentially  slow.

   Approximate Matching
       When  matching  approximately,  the shell keeps a count of
       the errors found, which cannot exceed the number specified
       in the (#anum) flags.  Four types of error are recognised:

       1.     Different characters, as in fooxbar and fooybar.

       2.     Transposition  of  characters,  as  in  banana  and
              abnana.

       3.     A  character  missing in the target string, as with
       match exactly are initial dots in  filenames  (unless  the
       GLOB_DOTS option is set), and all slashes in filenames, so
       that a/bc is two errors from ab/c  (the  slash  cannot  be
       transposed with another character).  Similarly, errors are
       counted separately for non-contiguous strings in the  pat­
       tern, so that (ab|cd)ef is two errors from aebf.

       When  using  exclusion  via  the  ~  operator, approximate
       matching is treated entirely separately for  the  excluded
       part    and   must   be   activated   separately.    Thus,
       (#a1)README~READ_ME matches READ.ME but  not  READ_ME,  as
       the  trailing  READ_ME  is  matched without approximation.
       However, (#a1)README~(#a1)READ_ME does not match any  pat­
       tern  of  the  form  READ?ME  as  all  such  forms are now
       excluded.

       Apart from exclusions, there is  only  one  overall  error
       count;  however, the maximum errors allowed may be altered
       locally, and this can be delimited by grouping.  For exam­
       ple,  (#a1)cat((#a0)dog)fox  allows  one  error  in total,
       which may not occur in the dog section,  and  the  pattern
       (#a1)cat(#a0)dog(#a1)fox  is  equivalent.   Note  that the
       point at which an error is first found is the crucial  one
       for  establishing  whether to use approximation; for exam­
       ple, (#a1)abc(#a0)xyz will not match abcdxyz, because  the
       error  occurs  at  the  `x', where approximation is turned
       off.

       Entire path segments may be matched approximately, so that
       `(#a1)/foo/d/is/available/at/the/bar'  allows one error in
       any path segment.  This is much less efficient than  with­
       out  the (#a1), however, since every directory in the path
       must be scanned for a possible approximate match.   It  is
       best  to place the (#a1) after any path segments which are
       known to be correct.

   Recursive Globbing
       A pathname component of the form `(foo/)#' matches a  path
       consisting  of  zero or more directories matching the pat­
       tern foo.

       As a shorthand, `**/' is equivalent to `(*/)#'; note  that
       this  therefore  matches files in the current directory as
       well as subdirectories.  Thus:

              ls (*/)#bar

       or

              ls **/bar

       If  the  option BARE_GLOB_QUAL is set, then a trailing set
       of parentheses containing no `|' or `(' characters (or `~'
       if it is special) is taken as a set of glob qualifiers.  A
       glob subexpression that would normally be  taken  as  glob
       qualifiers,  for  example  `(^x)',  can  be  forced  to be
       treated as part of the glob pattern by doubling the paren­
       theses, in this case producing `((^x))'.

       If the option EXTENDED_GLOB is set, a different syntax for
       glob qualifiers is available, namely `(#qx)'  where  x  is
       any  of the same glob qualifiers used in the other format.
       The qualifiers must still appear at the end  of  the  pat­
       tern.   However, with this syntax multiple glob qualifiers
       may be chained together.  They are treated  as  a  logical
       AND  of the individual sets of flags.  Also, as the syntax
       is unambiguous, the expression will  be  treated  as  glob
       qualifiers  just  as long any parentheses contained within
       it are balanced; appearance of `|', `(' or  `~'  does  not
       negate  the  effect.   Note that qualifiers will be recog­
       nised in this form even if a bare glob qualifier exists at
       the  end  of  the  pattern,  for  example `*(#q*)(.)' will
       recognise executable regular files  if  both  options  are
       set;  however, mixed syntax should probably be avoided for
       the sake of clarity.

       A qualifier may be any one of the following:

       /      directories

       .      plain files

       @      symbolic links

       =      sockets

       p      named pipes (FIFOs)

       *      executable plain files (0100)

       %      device files (character or block special)

       %b     block special files

       %c     character special files

       r      owner-readable files (0400)

       w      owner-writable files (0200)

       x      owner-executable files (0100)

       A      group-readable files (0040)

       t      files with the sticky bit (01000)

       fspec  files with access rights matching spec.  This  spec
              may be a octal number optionally preceded by a `=',
              a `+', or a `-'. If none  of  these  characters  is
              given,  the  behavior  is  the same as for `='. The
              octal  number  describes  the  mode  bits   to   be
              expected,  if  combined with a `=', the value given
              must match the file-modes exactly, with a  `+',  at
              least  the  bits in the given number must be set in
              the file-modes, and with a `-',  the  bits  in  the
              number  must  not be set. Giving a `?' instead of a
              octal digit anywhere in the number ensures that the
              corresponding   bits  in  the  file-modes  are  not
              checked, this is only useful  in  combination  with
              `='.

              If the qualifier `f' is followed by any other char­
              acter anything up to the  next  matching  character
              (`[',  `{', and `<' match `]', `}', and `>' respec­
              tively, any  other  character  matches  itself)  is
              taken  as a list of comma-separated sub-specs. Each
              sub-spec may be either an octal number as described
              above  or a list of any of the characters `u', `g',
              `o', and `a', followed by a `=', a `+', or  a  `-',
              followed  by  a  list of any of the characters `r',
              `w', `x', `s', and `t',  or  an  octal  digit.  The
              first  list  of  characters  specify  which  access
              rights are to be checked. If a `u' is given,  those
              for  the  owner  of  the file are used, if a `g' is
              given, those of the group are checked, a `o'  means
              to  test  those of other users, and the `a' says to
              test all three groups. The `=', `+', and `-'  again
              says  how  the modes are to be checked and have the
              same meaning as described for the first form above.
              The  second  list  of characters finally says which
              access rights are to  be  expected:  `r'  for  read
              access,  `w' for write access, `x' for the right to
              execute the file (or to search  a  directory),  `s'
              for  the  setuid  and  setgid bits, and `t' for the
              sticky bit.

              Thus, `*(f70?)' gives the files for which the owner
              has  read,  write,  and execute permission, and for
              which other group members have no rights,  indepen­
              dent  of  the permissions for other users. The pat­
              tern `*(f-100)' gives all files for which the owner
              does    not    have    execute    permission,   and
              `*(f:gu+w,o-rx:)' gives the  files  for  which  the
              owner  and  the  other members of the group have at
              least write permission, and for which  other  users

              During  the  execution  of string the filename cur­
              rently being tested is available in  the  parameter
              REPLY;  the parameter may be altered to a string to
              be inserted into the list instead of  the  original
              filename.   In addition, the parameter reply may be
              set to an array or a string,  which  overrides  the
              value  of REPLY.  If set to an array, the latter is
              inserted into the command line word by word.

              For example, suppose a directory contains a  single
              file     `lonely'.      Then     the     expression
              `*(e:'reply=(${REPLY}{1,2})':)'  will   cause   the
              words  `lonely1  lonely2'  to  be inserted into the
              command line.  Note the quotation marks.

       ddev   files on the device dev

       l[-|+]ct
              files having a link count less than ct (-), greater
              than ct (+), or equal to ct

       U      files owned by the effective user ID

       G      files owned by the effective group ID

       uid    files  owned  by  user  ID id if it is a number, if
              not, than the character after the `u' will be  used
              as  a  separator  and the string between it and the
              next matching separator (`[', `{',  and  `<'  match
              `]', `}', and `>' respectively, any other character
              matches itself) will be taken as a user  name,  and
              the  user  ID  of  this  user  will  be taken (e.g.
              `u:foo:' or `u[foo]' for user `foo')

       gid    like uid but with group IDs or names

       a[Mwhms][-|+]n
              files accessed exactly n days ago.  Files  accessed
              within  the  last n days are selected using a nega­
              tive value for n (-n).  Files accessed more than  n
              days  ago  are selected by a positive n value (+n).
              Optional unit specifiers `M', `w', `h', `m' or  `s'
              (e.g.  `ah5')  cause the check to be performed with
              months (of 30 days), weeks, hours, minutes or  sec­
              onds  instead of days, respectively.  For instance,
              `echo *(ah-5)' would echo files accessed within the
              last five hours.

       m[Mwhms][-|+]n
              like the file access qualifier, except that it uses
              the file modification time.

       -      toggles between making the qualifiers work on  sym­
              bolic  links (the default) and the files they point
              to

       M      sets the MARK_DIRS option for the current pattern

       T      appends a trailing qualifier mark to the filenames,
              analogous to the LIST_TYPES option, for the current
              pattern (overrides M)

       N      sets the NULL_GLOB option for the current pattern

       D      sets the GLOB_DOTS option for the current pattern

       n      sets the NUMERIC_GLOB_SORT option for  the  current
              pattern

       oc     specifies  how  the  names  of  the files should be
              sorted. If c is n they  are  sorted  by  name  (the
              default);  if  it is L they are sorted depending on
              the size (length) of  the  files;  if  l  they  are
              sorted  by  the number of links; if a, m, or c they
              are sorted by the time of the last access,  modifi­
              cation,  or  inode change respectively; if d, files
              in subdirectories appear before those in  the  cur­
              rent directory at each level of the search --- this
              is best combined with other criteria,  for  example
              `odon'  to  sort on names for files within the same
              directory.  Note that a, m, and c compare  the  age
              against  the  current time, hence the first name in
              the list is the youngest file. Also note  that  the
              modifiers  ^  and  - are used, so `*(^-oL)' gives a
              list of all files sorted by file size in descending
              order, following any symbolic links.

       Oc     like  `o',  but  sorts  in  descending  order; i.e.
              `*(^oc)' is the same as `*(Oc)' and `*(^Oc)' is the
              same  as  `*(oc)';  `Od'  puts files in the current
              directory before those in  subdirectories  at  each
              level of the search.

       [beg[,end]]
              specifies  which of the matched filenames should be
              included in the returned list. The  syntax  is  the
              same  as for array subscripts. beg and the optional
              end may be mathematical expressions. As in  parame­
              ter  subscripting they may be negative to make them
              count  from  the   last   match   backward.   E.g.:
              `*(-OL[1,3])'  gives  a  list  of  the names of the
              three largest files.

       fication does not have to be an existing file.   The  name
       of  any existing file can be followed by a modifier of the
       form `(:..)' even if no actual filename generation is per­
       formed.  Thus:

              ls *(-/)

       lists  all  directories  and  symbolic links that point to
       directories, and

              ls *(%W)

       lists all  world-writable  device  files  in  the  current
       directory, and

              ls *(W,X)

       lists   all  files  in  the  current  directory  that  are
       world-writable or world-executable, and

              echo /tmp/foo*(u0^@:t)

       outputs the basename of  all  root-owned  files  beginning
       with the string `foo' in /tmp, ignoring symlinks, and

              ls *.*~(lex|parse).[ch](^D^l1)

       lists  all  files  having  a link count of one whose names
       contain a dot (but not those starting with  a  dot,  since
       GLOB_DOTS  is  explicitly  switched off) except for lex.c,
       lex.h, parse.c and parse.h.

              print b*.pro(#q:s/pro/shmo/)(#q.:s/builtin/shmiltin/)

       demonstrates how colon modifiers and other qualifiers  may
       be  chained  together.   The  ordinary  qualifier  `.'  is
       applied first, then the colon modifiers in order from left
       to right.  So if EXTENDED_GLOB is set and the base pattern
       matches the regular file builtin.pro, the shell will print
       `shmiltin.shmo'.

zsh 4.1.1                 June 18, 2003                ZSHEXPN(1)
  




Login
Nickname

Password

Security Code
Security Code
Type Security Code


Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!


Amazon Wish List

Did You Know?
You can choose larger fonts by selecting a different themes.


Friends



Tell a Friend About Us

Bookmark and Share



Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.23 Seconds