linux sh 的语法

sh [-a] [-c] [-C] [-e] [-E] [-f] [-h] [-i] [-I][-k] [-m] [-n] [-p] [-r] [-s] [-t] [-T] [-u] [-v] [-x] [ argument ]



-a

Export all variables assigned to.



-c

Pass the string argument to the shell to be interpreted as input. Keep in mind that this option only accepts a single string as its argument, hence multi-word strings must be quoted.



-C

Don't overwrite existing files with ``>.''



-e

If not interactive, exit immediately if any untested command fails. The exit status of a command is considered to be explic- itly tested if the command is used to control an if, elif, while, or until; or if the command is the left hand operand of an ``&&'' or ``||'' operator.



-E

Enable the built-in emacs command line editor (disables -V if it has been set).



-f

Disable pathname expansion.



-h

Makes all commands use tracked aliases.



-i

Force the shell to behave interactively.



-I

Ignore EOF's from input when interactive.



-k

tells the shell to use Korn-compatible behavior in any case where the POSIX.2 behavior is different from the behavior specified by Korn. In particular, this affects the trap command.



-m

Turn on job control (set automatically when interactive).



-n

If not interactive, read commands but do not execute them. This is useful for checking the syntax of shell scripts.



-p

Turn on privileged mode. This mode is enabled on startup if either the effective user or group id is not equal to the real user or group id. Turning this mode off sets the effective user and group ids to the real user and group ids. Also on interactive shells and when enabled, this mode sources /etc/suid_profile (in- stead of ~/.profile) after /etc/profile and ignores the contents of the ENV variable.



-r

Invokes a restricted shell. In a restricted shell, you cannot do any of the following: use the cd command; change the values of the variables env, path or shell; use > or >> to redirect output; specify command names containing /. These restrictions do not apply during execution of profile files.



-s

Read commands from standard input (set automatically if no file arguments are present). This option has no effect when set after the shell has already started running (i.e. with set).



-t

Exits after reading and executing one command.



-T

When waiting for a child, execute traps immediately. If this option is not set, traps are executed after the child exits, as specified in IEEE Std1003.2 (``POSIX'') This nonstandard option is useful to put guarding shells around childs that block signals. The surrounding shell may kill the child or it may just re- turn control to the tty and leave the child alone.



-u

Write a message to standard error when attempting to expand a variable that is not set, and if the shell is not interactive, exit immediately.



-v

The shell writes its input to standard error as it is read. Useful for debugging.



-V

Enable the built-in vi command line editor (disables -E if it has been set).



-x

Write each command to standard error (preceded by a '+ ') before it is executed. Useful for debugging.

 

posted on 2013-01-25 11:55  NeverGiveUp_ZONE  阅读(30871)  评论(1编辑  收藏  举报