Reference: shift
Author: Daniel Gilly & the Staff of O'Reilly & Associates
Date: 1998-08-06T21:59:32Z

#

| Chapter 5 The C Shell |

## shift

    shift [variable]

If `variable` is given, shift the words in a wordlist variable; i.e., `name`[2] becomes `name`[1]. With no argument, shift the positional parameters (command-line arguments); i.e., $2 becomes $1. shift is typically used in a while loop. See additional example under while.

### Example

>     while ($#argv)      # while there are arguments
>         if (-f $argv[1])
>            wc -l $argv[1]
>         else
>            echo "$argv[1] is not a regular file"
>         endif
>         shift           # get the next argument
>     end

Reference: setenv |  | Reference: source