Up Next Previous

## Argument list processing

If the first argument (argument 0) to the shell is `-' then it is a login shell. A login shell can be also specified by invoking the shell with the -l flag as the only argument.

The rest of the flag arguments are interpreted as follows:

-b
  Forces a ``break'' from option processing, causing any further shell arguments to be treated as non-option arguments. The remaining arguments will not be interpreted as shell options. This may be used to pass options to a shell script without confusion or possible subterfuge. The shell will not run a set-user ID script without this option.

-c
  Commands are read from the following argument (which must be present, and must be a single argument), stored in the command shell variable for reference, and executed. Any remaining arguments are placed in the argv shell variable.

-d
  The shell loads the directory stack from ~/.cshdirs as described under Startup and shutdown, whether or not it is a login shell. (+)

-Dname[=value]
  Sets the environment variable name to value. (Domain/OS only) (+)

-e
  The shell exits if any invoked command terminates abnormally or yields a non-zero exit status.

-f
  The shell does not load any resource or startup files, or perform any command hashing, and thus starts faster.

-F
  The shell uses fork(2) instead of vfork(2) to spawn processes. (+)

-i
  The shell is interactive and prompts for its top-level input, even if it appears to not be a terminal. Shells are interactive without this option if their inputs and outputs are terminals.

-l
  The shell is a login shell. Applicable only if -l is the only flag specified.

-m
  The shell loads ~/.tcshrc even if it does not belong to the effective user. Newer versions of su(1) can pass -m to the shell. (+)

-n
  The shell parses commands but does not execute them. This aids in debugging shell scripts.

-q
  The shell accepts SIGQUIT (see Signal handling) and behaves when it is used under a debugger. Job control is disabled. (u)

-s
  Command input is taken from the standard input.

-t
  The shell reads and executes a single line of input. A `\' may be used to escape the newline at the end of this line and continue onto another line.

-v
  Sets the verbose shell variable, so that command input is echoed after history substitution.

-x
  Sets the echo shell variable, so that commands are echoed immediately before execution.

-V
  Sets the verbose shell variable even before executing ~/.tcshrc.

-X
  Is to -x as -V is to -v.

--help
  Print a help message on the standard output and exit. (+)

--version
  Print the version/platform/compilation options on the standard output and exit. This information is also contained in the version shell variable. (+)

After processing of flag arguments, if arguments remain but none of the -c, -i, -s, or -t options were given, the first argument is taken as the name of a file of commands, or ``script'', to be executed. The shell opens this file and saves its name for possible resubstitution by `$0'. Because many systems use either the standard version 6 or version 7 shells whose shell scripts are not compatible with this shell, the shell uses such a `standard' shell to execute a script whose first character is not a `#', i.e., that does not start with a comment.

Remaining arguments are placed in the argv shell variable.

Up Next Previous