Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Running a shell script z/OS UNIX System Services User's Guide SA23-2279-00 |
|
You can run a shell script by typing the name of the file that
contains the script. For example, suppose you have a script named totals.scp that
has three shell commands in it. If you enter:
the
shell runs the three commands.Before you can run a shell script, you must have read and execute permission to the file. Use the chmod and umask commands to set the permissions. See the discussion of permissions in Handling security for your files. For another example, suppose you want to compile a collection of
files written in the C programming language. You could use the c89, cc,
or c++ command. The c89 command,
for example, compiles any file file.c, link-edits the object
module, and produces an executable file. The shell script:
compiles
and link-edits the files and produces an executable file, outfile.
Notice that in a shell script you precede a comment with a #.If you store this script in an executable file named compile, it could be run with the single command compile. A new process is created for the script to run in. To run a shell script in your current environment, without creating
a new process, use the . (dot) command. You could run the compile shell
script this way:
If you want to use
a shell script that updates a variable in the current environment,
run it with the . command.Tip: You can improve shell script performance by setting
the _BPX_SPAWN_SCRIPT environment variable to a value of YES. See Improving the performance of shell scripts for more information.
|
Copyright IBM Corporation 1990, 2014
|