16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

sh<br />

Options<br />

and runs this file with the . command if it exists. You do not get an error message if<br />

any of these files cannot be found.<br />

You can use these profile files to customize your session with sh. For example,<br />

your profile files can set options, create aliases, or define functions and variables.<br />

If there is at least one argument on the sh command line, sh takes the first<br />

argument as the name of a shell script to run. (The exception to this is when –s is<br />

used.) Any additional arguments are assigned to the positional parameters; usually,<br />

these serve as arguments to the shell script. See “Parameter Substitution” on page<br />

559 for information about positional parameters. Also see set for information about<br />

changing these parameters.<br />

If sh finds the ENV environment variable set when it begins running (after profile<br />

processing), sh runs the file named by the expansion of the value of this variable.<br />

The shell accepts the following options on the command line:<br />

–c cmdstring<br />

Runs cmdstring as if it were an input line to the shell and then exits. This is<br />

used by programs (for example, editors) that call the shell for a single<br />

command. sh assigns arguments after cmdstring to the positional<br />

parameters. If you specify cmd_name, special parameter 0 is set to this<br />

string for use when running the commands in cmdstring.<br />

–i Invokes an interactive shell, as opposed to running a script.With –i, the<br />

shell catches and ignores keyboard interrupts. Without –i, an interrupt ends<br />

the shell. For shells that read from the terminal, –i is the default.<br />

–L Makes the shell a login shell, as described earlier. (A login shell is an<br />

interactive shell.)<br />

–r Invokes a restricted shell. (As noted earlier, you can also invoke a restricted<br />

shell by usingthe name rsh). In a restricted shell, you cannot do the<br />

following:<br />

v Use the cd command<br />

v Change the values of the variables ENV, PATH, or SHELL<br />

v Use > or >> to redirect output; or specify command names containing /<br />

These restrictions do not apply during execution of your profile files.<br />

–s Reads commands from standard input (stdin) and assigns all arguments to<br />

the positional parameters. Normally, if there is at least one argument to the<br />

shell, the first such argument is the name of a file to be run.<br />

–S Searches the directories in the environment variable PATH for a file<br />

cmd_file that contains shell commands. The current working directory is not<br />

searched before PATH.<br />

If you do not give either the –c or –s option, but you do specify cmd_file, the shell<br />

takes it as the name of a file that contains commands to be run. Special parameter<br />

0 is set to this name.<br />

If cmd_file contains a slash, the shell attempts to read that filename. If cmd_file<br />

does not contain a slash, the following can occur:<br />

v If –S is specified, the shell searches for the file in PATH. Only a file with<br />

executable access permissions for the user will be found in the PATH search.<br />

550 z/<strong>OS</strong> <strong>V1R9.0</strong> <strong>UNIX</strong> <strong>System</strong> <strong>Services</strong> <strong>Command</strong> Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!