DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Programming with the SCO OpenServer system shell

The vocabulary of shell command language

The following sections list metacharacters, special characters, input and output redirection, variables, and process control.

Special characters in the shell


* ? [ ]
Metacharacters; used to provide a shortcut to referencing filenames, through pattern matching.

&
Executes commands in the background mode.

;
Sequentially executes several commands typed on one line, each pair separated by ;.

\
Turns off the meaning of the immediately following special character.

´...´
Enclosing single quotes turn off the special meaning of all characters except single quotes.

...
Enclosing double quotes turn off the special meaning of all characters except $, single quotes, and double quotes.

Redirecting input and output


<
Redirects the contents of a file into a command.

>
Redirects the output of a command into a new file, or replaces the contents of an existing file with the output.

>>
Redirects the output of a command so that it is appended to the end of a file.

|
Directs the output of one command so that it becomes the input of the next command.

`command`
Substitutes the output of the enclosed command in place of `command`.

Executing and terminating processes


batch
Submits the following commands to be processed at a time when the system load is at an acceptable level. <CTRL-d> ends the batch command.

at
Submits the following commands to be executed at a specified time. <CTRL-d> ends the at command.

at -l
Reports which jobs are currently in the at or batch queue.

at -r
Removes the at or batch job from the queue.

ps
Reports the status of the shell processes.

kill PID
Terminates the shell process with the specified process ID (PID).

nohup command list &

Continues background processes after logging out.

Making a file accessible to the shell


chmod u+x filename

Gives the user permission to execute the file (useful for shell program files).

mv filename $HOME/bin/filename

Moves your file to the bin directory in your home directory. This bin holds executable shell programs that you want to be accessible. Make sure the PATH variable in your .profile file specifies this bin. If it does, the shell will search in $HOME/bin for your file when you try to execute it. If your PATH variable does not include your bin, the shell will not know where to find your file and your attempt to execute it will fail.

filename
The name of a file that contains a shell program becomes the command that you type to run that shell program.

Variables


positional parameter

A numbered variable used within a shell program to reference values automatically assigned by the shell from the arguments of the command line invoking the shell program.

echo
A command used to print the value of a variable on your terminal.

``$#''
A special parameter that contains the number of arguments with which the shell program has been executed.

``$*''
A special parameter that contains the values of all arguments with which the shell program has been executed.

named variable

A variable to which the user can give a name and assign values.

Variables used in the system


HOME
Denotes your home directory; the default variable for the cd command.

PATH
Defines the path your login shell follows to find commands.

MAIL
Gives the name of the file containing your electronic mail.

PS1, PS2
Defines the primary and secondary prompt strings, respectively.

TERM
Defines the type of terminal.

LOGNAME
Login name of the user.

IFS
Defines the internal field separators (normally the space, the tab, and the carriage return).

TERMINFO
Allows you to request that the curses and terminfo subroutines search a specified directory tree before searching the default directory for your terminal type.

TZ
Sets and maintains the local time zone.

Next topic: Shell programming constructs
Previous topic: Summary of shell command language

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005