emulate [ -LR ] [ {zsh|sh|ksh|csh} [ flags ... ] ]
       Without any argument print current emulation mode.

       With single argument set up zsh options to  emulate
       shell   as   much   as possible.  csh will never be
       If the argument is not one  of  the  shells  listed
       be  used  as  a  default; more precisely, the tests
       argument are the same as those  used  to  determine
       at   startup  based on the shell name, see the sec-
       ITY in zsh(1) .  In addition to setting  shell  op-
       mand   also  restores the pristine state of pattern
       all patterns had been enabled using enable -p.

       If the emulate command  occurs  inside  a  function
       marked   for   execution  tracing with functions -t
       option will be turned on  regardless  of  emulation
       options.   Note that code executed inside the func-
       source, or  eval  commands  is  not  considered  to
       directly   from   the function, hence does not pro-
       iour.

       If the -R switch is given,  all  settable   options
       their  default  value  corresponding  to the speci-
       mode, except for  certain  options  describing  the
       environment;    otherwise,   only   those   options
       portability problems in scripts and  functions  are
       the   -L   switch   is given, the options LOCAL OP-
       TERNS and LOCAL TRAPS will be set as well,  causing
       of   the emulate command and any setopt, disable -p
       and trap commands to be local  to  the  immediately
       shell  function, if any; normally these options are
       all emulation modes except ksh. The  -L  switch  is
       sive with the use of -c in flags.

       The  flags  may be any of the invocation-time flags
       the section INVOCATION in zsh(1), except  that  `-o
       VI'   may  not be used.  Flags such as `+r'/`+o RE-
       prohibited in some circumstances.

       If -c arg appears in flags, arg is evaluated  while
       emulation   is temporarily in effect.  In this case
       mode and all  options   are   restored   to   their
       before   emulate   returns.  The -R switch may pre-
       the shell to emulate; note this   has   a   meaning
       including -R in flags.

       Use   of  -c  enables  `sticky'  emulation mode for
       within the  evaluated  expression:   the  emulation
       ated  thereafter with the function so that whenever
       is  executed  the  emulation  (respecting  the   -R
       and   all   options   are set (and pattern disables
       entry to the function, and the  state  is  restored
       the   function  is called when the sticky emulation
       effect, either within an `emulate shell -c' expres-
       another   function  with the same sticky emulation,
       from the function do not cause options  to  be  al-
       to   standard  processing such as the LOCAL OPTIONS
       also applies to functions marked for autoload with-
       emulation;  the  appropriate set of options will be
       point the function is loaded as well as when it  is

       For example:

              emulate sh -c 'fni() { setopt cshnullglob; }
              fno() { fni; }'
              fno

       The  two  functions  fni  and  fno are defined with
       tion.   fno  is  then   executed,  causing  options
       emulations  to  be  set to their values in sh.  fni
       because  fno  is  also marked for sticky sh  emula-
       changes take place on entry to  or  exit  from  it.
       option  cshnullglob,  turned off by  sh  emulation,
       on  within  fni and remain on on return to fno.  On
       the emulation mode and all options will be restored
       they  were  in before entry to the temporary emula-

       The documentation above is typically sufficient for
       purpose   of   executing  code  designed  for other
       able environment.  More detailed rules follow.
       1.     The sticky emulation  environment   provided
              shell   -c'  is  identical  to that provided
              function marked for sticky  emulation  as  a
              being   defined   in  such  an  environment.
              ple, the sticky emulation is  inherited   by
              defined  within functions with sticky emula-
       2.     No change of options takes place on entry to
              functions that are not marked for sticky em-
              than  those that would normally take  place,
              functions  are  called  within sticky emula-
       3.     No special handling is  provided  for  func-
              autoload  nor for functions present in word-
              the zcompile command.
       4.     The presence or absence of the -R switch  to
              responds   to   different  sticky  emulation
              example `emulate sh -c', `emulate -R sh  -c'
              csh -c' are treated as three distinct sticky
       5.     Difference  in  shell  options  supplied  in
              basic  emulation also mean the sticky emula-
              ferent,  so for example `emulate zsh -c' and
`emulate zsh

              -o cbases -c' are treated as distinct sticky
