8000 minix/man/man1/ash.1 at v3.1.5 · lgqgood/minix · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
1131 lines (1130 loc) · 36.6 KB

ash.1

File metadata and controls

1131 lines (1130 loc) · 36.6 KB
.I exitstatus
is given it is used as the
exit status of the shell; otherwise the exit status of the preceding
command is used.
.b export
.IR name ...
.br
The specified names are exported so that they will appear in the environment
of subsequent commands. The only way to un-export a variable is to unset it.
.I Ash
allows the value of a variable to be set at the same time it is exported
by writing
.d
\fBexport\fR name=value
.e
With no arguments the export command lists the names of all exported variables.
.b fg
[
.I job
]
.br
Move the specified job or the current job to the foreground.
This command is only available on systems with Bekeley job control.
.b getopts
.I optstring
.I var
.br
The System V
.I getopts
command.
.b hash
.B -rv
.IR command ...
.br
The shell maintains a hash table which remembers the locations of
commands. With no arguments whatsoever, the hash command prints
out the contents of this table. Entries which have not been looked
at since the last
.I cd
command are marked with an asterisk; it is possible for these entries
to be invalid.
.sp
With arguments, the hash command removes the specified commands from
the hash table (unless they are functions) and then locates them.
With the
.B -v
option,
.I hash
prints the locations of the commands as it finds them.
The
.B -r
option causes the
.I hash
command to delete all the entries in the hash table except for
functions.
.b jobid
[
.I job
]
.br
Print the process id's of the processes in the job. If the job argument
is omitted, use the current job.
.b jobs
.br
This command lists out all the background processes which are children
of the current shell process.
.b pwd
.br
Print the current directory. The builtin command may differ from the
program of the same name because the builtin command remembers what
the current directory is rather than recomputing it each time. This
makes it faster. However, if the current directory is renamed, the
builtin version of pwd will continue to print the old name for the
directory.
.b read
[
.B -p
.I prompt
]
[
.B -e
]
.IR variable ...
.br
The prompt is printed if the
.B -p
option is specified and the standard input is a terminal. Then a
line is read from the standard input. The trailing newline is deleted
from the line and the line is split as described
in the section on word splitting above, and the pieces are assigned to
the variables in order. If there are more pieces than variables, the
remaining pieces (along with the characters in IFS that separated them)
are assigned to the last variable. If there are more variables than
pieces, the remaining variables are assigned the null string.
.sp
The
.B -e
option causes any backslashes in the input to be treated specially.
If a backslash is followed by a newline, the backslash and the newline
will be deleted. If a backslash is followed by any other character,
the backslash will be deleted and the following character will be treated
as though it were not in IFS, even if it is.
.b readonly
.IR name ...
.br
The specified names are marked as read only, so that they cannot be
subsequently modified or unset.
.I Ash
allows the value of a variable to be set at the same time it is marked
read only by writing
.d
\fBreadonly\fR name=value
.e
With no arguments the readonly command lists the names of all
read only variables.
.b set
[
{
.BI - options
|
.BI + options
|
.B --
}
]
.IR arg ...
.br
The
.I set
command performs three different functions.
.sp
With no arguments, it lists the values of all shell variables.
.sp
If options are given, it sets the specified option flags, or clears
them if the option flags are introduced with a
.B +
rather than a
.BR - .
Only the first argument to
.I set
can contain options.
The possible options are:
.sp
.ta 0.4i
.in +0.4i
.ti -0.4i
\fB-e\fR Causes the shell to exit when a command terminates with
a nonzero exit status, except when the exit status of the command is
explicitly tested. The exit status of a command is considered to be
explicitly tested if the command is used to control an
.IR if ,
.IR elif ,
.IR while ,
or
.IR until ;
or if the command is the left hand operand of an ``&&'' or ``||''
operator.
.sp
.ti -0.4i
\fB-f\fR Turn off file name generation.
.sp
.ti -0.4i
\fB-I\fR Cause the shell to ignore end of file conditions.
(This doesn't apply when the shell a script sourced using the ``.''
command.) The shell will in fact exit if it gets 50 eof's in a
row.
.sp
.ti -0.4i
\fB-i\fR Make the shell interactive. This causes the shell to
prompt for input, to trap interrupts, to ignore quit and terminate signals,
and to return to the main command loop rather than exiting on error.
.sp
.ti -0.4i
\fB-j\fR Turns on Berkeley job control, on systems that support it.
When the shell starts up, the
.B -j
is set by default if the
.B -i
flag is set.
.sp
.ti -0.4i
\fB-n\fR Causes the shell to read commands but not execute them.
(This is marginally useful for checking the syntax of scripts.)
.sp
.ti -0.4i
\fB-s\fR If this flag is set when the shell starts up, the shell
reads commands from its standard input. The shell doesn't examine the
value of this flag any other time.
.sp
.ti -0.4i
\fB-x\fR If this flag is set, the shell will print out each
command before executing it.
.sp
.ti -0.4i
\fB-z\fR If this flag is set, the file name generation process
may generate zero files. If it is not set, then a pattern which does
not match any files will be replaced by a quoted version of the pattern.
.in -0.4i
.sp
The third use of the set command is to set the values of the shell's
positional parameters to the specified
.IR args .
To change the positional parameters without changing any options,
use ``\fB--\fR'' as the first argument to
.IR set .
If no args are present, the set command will leave the value of the
positional parameters unchanged, so to set the positional parameters
to set of values that may be empty, execute the command
.d
shift $#
.e
first to clear out the old values of the positional parameters.
.b setvar
.I variable
.I value
.br
Assigns
.I value
to
.IR variable .
(In general it is better to write
.I variable=value
rather than using
.IR setvar .
.I Setvar
is intended to be used in functions that assign values to variables whose
names are passed as parameters.)
.b shift
[
.I n
]
.br
Shift the positional parameters
.I n
times.
A shift sets the value of $1 to the value of $2, the value of $2 to
the value of $3, and so on, decreasing the value of $# by one.
If there are zero positional parameters, shifting doesn't do anything.
.b trap
[
.I action
]
.IR signal ...
.br
Cause the shell to parse and execute
.I action
when any of the specified signals are received.
The signals are specified by signal number.
.I Action
may be null or omitted;
the former causes the specified signal to be ignored and the latter
causes the default action to be taken.
When the shell forks off a subshell, it resets trapped (but not ignored)
signals to the default action.
The trap command has no effect on signals that were ignored on entry
to the shell.
.b umask
[
.I mask
]
.br
Set the value of umask (see
.IR umask (2))
to the specified octal value. If the argument is omitted, the umask
0