'shift' what does it ?

'shift' what does it ?

Post by Bill Mitche » Fri, 08 Sep 1995 04:00:00




Quote:>What does the command  shift <number> ??

"man shift" should have found this for you:

BASH_BUILTINS(1)                                 BASH_BUILTINS(1)
[...]
       shift [n]
              The  positional parameters from n+1 ... are renamed
              to $1 ....  Parameters represented by  the  numbers
              $# down to $#-n+1 are unset.  If n is 0, no parame-
              ters are changed. If n is not given, it is assumed
              to be 1.  n must be a non-negative number less than
              or equal to $#.  If n is greater than $#, the posi-
              tional parameters are not changed.  The return sta-
              tus is greater than 0 if n is greater  than  $#  or
              less than 0; otherwise 0.
--

 
 
 

'shift' what does it ?

Post by Stephan Eisenhar » Sat, 09 Sep 1995 04:00:00


|>
|> What does the command  shift <number> ??
|>
|> There is no man page. It looks to me that it is something from bash, but I
|> don't know what.
                                                   ^^^^^^^^^^^^^^^^^^^
                                                   indeed, so have a look
                                                   in your shells man page

e.g. for csh (I use tcsh and there is no man page for bash on our system) you can find something like:

     shift
     shift variable
          The members of argv are shifted to the left, discarding argv[1]. It
          is an error for argv not to be set or to have less than one word as
          value.  The second form performs the same function on the specified
          variable.

or my "UNIX in a Nutshell" tells me for bourne shell:

     shift [n]
          Shift positional arguments (e.g., $2 becomes $1). If n is given, shift
          to the left n places. Used in while loops to iterate throughj command
          line arguments.

It should be clear now...?

        Ciao
                Stephan

 
 
 

'shift' what does it ?

Post by Stephane Len » Sat, 09 Sep 1995 04:00:00


: What does the command  shift <number> ??

: There is no man page. It looks to me that it is something from bash, but I
: don't know what.

: Gerhard.

here's my man page :

NAME
     shift - shell built-in function to traverse either a shell's
     argument list or a list of field-separated words

SYNOPSIS
  sh
     shift [ n ]

  csh
     shift [ variable ]

  ksh
     *
     shift [ n ]

DESCRIPTION
  sh
     The positional parameters from  $n+1  ...   are  renamed  $1
     ... .  If n is not given, it is assumed to be 1.

  csh
     The components  of  argv,  or  variable,  if  supplied,  are
     shifted  to the left, discarding the first component.  It is
     an error for the variable not to be set or to  have  a  null
     value.

  ksh
     The positional parameters from $n+1 $n+1 ...  are renamed $1
     ...,  default n is 1.  The parameter n can be any arithmetic
     expression that evaluates to a non-negative number less than
     or equal to $#.

     On this man page, ksh(1) commands that are preceded  by  one
     or  two * (asterisks) are treated specially in the following
     ways:
     1.   Variable assignment lists preceding the command  remain
          in effect when the command completes.
     2.   I/O redirections are processed after  variable  assign-
          ments.
     3.   Errors cause a script that contains them to abort.
     4.   Words, following a command preceded by ** that  are  in
          the  format of a variable assignment, are expanded with
          the same rules as a variable  assignment.   This  means
          that  tilde  substitution is performed after the = sign
          and word splitting and file  name  generation  are  not
          performed.

SEE ALSO
     csh(1), ksh(1), sh(1)

Couldn't have been clearer
--

------- * DESS GENIE LOGICIEL (SOFTWARE ENGINEERING) * --------
---It's better to burn out then to fade away ------------------
WWW :   http://www.emi.u-bordeaux.fr/~lentz

 
 
 

1. Request headers - 'Reload', <SHIFT>+'Reload'

I was wondering what request headers browser send
when user press 'Reload' ('Refresh') and
<shift>+'Reload'.  Actually I interested about IE 4 (5)
browsers. NS 4 seems send Pragma: no-cache

--  Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)

phone: +007(095)939-16-83, +007(095)939-23-83

2. Ping problem resolved...MANY THANKS!!!

3. starting off a dos-smtp-''project''

4. sed: extracting a pattern

5. Is e2label 'dangerous' when done on a 'live' file system?

6. Best Linux Installation for Personal Learning?

7. 'shift' what does it ?

8. 3c574_cs.c locking fixes

9. reverse-i-search with Amiga 'shift+up-arrow' binding?

10. (Subject line typed by somebody with stuck shift and '3' keys)

11. Newbie: What's done by 'alog' ?

12. hung after 'exit()' is called...what's it doing?

13. Doing 'stty erase ^H' on remote shells