neulab/tldr huggingface dataset:
cd [ -LP ] [ arg ] cd [ -LP ] old new This command can be in either of two forms.  In the first form it changes the current directory to arg.  If arg is - the directory is changed to the previous directory.  The shell variable HOME is the default arg.  The variable PWD is set to the current directory.  The shell variable CDPATH defines the search path for the directory containing arg.  Alternative directory names are separated by a colon (:).  The default path is <null> (specifying the current directory).  Note that the current directory is specified by a null path name, which can appear immediately after the equal sign or between the colon delimiters anywhere else in the path list.  If arg begins with a / then the search path is not used.  Otherwise, each directory in the path is searched for arg. The second form of cd substitutes the string new for the string old in the current directory name, PWD, and tries to change to this new directory. By default, symbolic link names are treated literally when finding the directory name.  This is equivalent to the -L option.  The -P option causes symbolic links to be resolved when determining the directory.  The last instance of -L or -P on the command line determines which method is used. The cd command may not be executed by rksh.
command [ -pvxV ] name [ arg ... ] Without the -v or -V options, command executes name with the arguments given by arg.  The -p option causes a default path to be searched rather than the one defined by the value of PATH. Functions will not be searched for when finding name.  In addition, if name refers to a special built-in, none of the special properties associated with the leading daggers will be honored.  (For example, the predefined alias redirect=′command exec′ prevents a script from terminating when an invalid redirection is given.)  With the -x option, if command execution would result in a failure because there are too many arguments, errno E2BIG, the shell will invoke command name multiple times with a subset of the arguments on each invocation.  Arguments that occur prior to the first word that expands to multiple arguments and after the last word that expands to multiple arguments will be passed on each invocation.  The exit status will be the maximum invocation exit status.  With the -v option, command is equivalent to the built-in whence command described below.  The -V option causes command to act like whence -v.
† continue [ n ] Resume the next iteration of the enclosing for, while, until, or select loop.  If n is specified, then resume at the n-th enclosing loop.
disown [ job... ] Causes the shell not to send a HUP signal to each given job, or all active jobs if job is omitted, when a login shell terminates.
echo [ -n  -e ] [  arg ... ] echo builtin prints all of its arguments separated by space and terminated by new-line.  -n will skip putting a newline character at the end of output. If -e is set, it will enable interpreting escape sequences.
†† enum [ -i  ] type[=(value ...) ] Creates a declaration command named type that is an integer type that allows one of the specified values as enumeration names.  If =(value ...) is omitted, then type must be an indexed array variable with at least two elements and the values are taken from this array variable.  If -i is specified the values are case insensitive. When an enumeration variable is used in arithmetic expression, its value is the index into the array that defined it starting from index 0.  Enumeration strings can be used in an arithmetic expression when comparing against an enumeration variable.  Also, each non-subscripted enumeration variable followed by .name where name is one of the enumeration names expands to the index corresponding to name. The enum _Bool is created with values true and false.  The predefined alias bool is defined as _Bool.
† eval [ arg ... ] The arguments are read as input to the shell and the resulting command(s) executed.
† exec [ -c ] [ -a name ] [ arg ... ] If arg is given, the command specified by the arguments is executed in place of this shell without creating a new process. The -c option causes the environment to be cleared before applying variable assignments associated with the exec invocation.  The -a option causes name rather than the first arg, to become argv[0] for the new process.  Input/output arguments may appear and affect the current process.  If arg is not given, the effect of this command is to modify file descriptors as prescribed by the input/output redirection list.  In this case, any file descriptor numbers greater than 2 that are opened with this mechanism are closed when invoking another program.
† exit [ n ] Causes the shell to exit with the exit status specified by n.  The value will be the least significant 8 bits of the specified status.  If n is omitted, then the exit status is that of the last command executed.  An end-of-file will also cause the shell to exit except for a shell which has the ignoreeof option (see set below) turned on.
†† export [ -p ] [ name[=value] ] ... If name is not given, the names and values of each variable with the export attribute are printed with the values quoted in a manner that allows them to be re-input.  The export command is the same as typeset -x except that if you use export within a function, no local variable is created.  The -p option causes the word export to be inserted before each one.  Otherwise, the given names are marked for automatic export to the environment of subsequently-executed commands.
false  Does nothing, and exits 1. Used with until for infinite loops.
fg [ job... ] This command is only on systems that support job control.  Each job specified is brought to the foreground and waited for in the specified order.  Otherwise, the current job is brought into the foreground.  See Jobs for a description of the format of job.
getopts [  -a name ] optstring vname [ arg ... ] Checks arg for legal options.  If arg is omitted, the positional parameters are used.  An option argument begins with a + or a -. An option not beginning with + or - or the argument -- ends the options.  Options beginning with + are only recognized when optstring begins with a +.  optstring contains the letters that getopts recognizes.  If a letter is followed by a :, that option is expected to have an argument.  The options can be separated from the argument by blanks.  The option -?  causes getopts to generate a usage message on standard error.  The -a argument can be used to specify the name to use for the usage message, which defaults to $0. getopts places the next option letter it finds inside variable vname each time it is invoked.  The option letter will be prepended with a + when arg begins with a +.  The index of the next arg is stored in OPTIND.  The option argument, if any, gets stored in OPTARG. A leading : in optstring causes getopts to store the letter of an invalid option in OPTARG, and to set vname to ?  for an unknown option and to : when a required option argument is missing. Otherwise, getopts prints an error message.  The exit status is non-zero when there are no more options. There is no way to specify any of the options :, +, -, ?, [, and ].  The option # can only be specified as the first option.
hist [ -e ename  ] [ -nlr ] [ first [ last ] ] hist -s  [ old=new ] [ command ] In the first form, a range of commands from first to last is selected from the last HISTSIZE commands that were typed at the terminal.  The arguments first and last may be specified as a number or as a string.  A string is used to locate the most recent command starting with the given string.  A negative number is used as an offset to the current command number.  If the -l option is selected, the commands are listed on standard output.  Otherwise, the editor program ename is invoked on a file containing these keyboard commands.  If ename is not supplied, then the value of the variable HISTEDIT is used.  If HISTEDIT is not set, then FCEDIT (default /bin/ed) is used as the editor.  When editing is complete, the edited command(s) is executed if the changes have been saved.  If last is not specified, then it will be set to first.  If first is not specified, the default is the previous command for editing and -16 for listing.  The option -r reverses the order of the commands and the option -n suppresses command numbers when listing.  In the second form, command is interpreted as first described above and defaults to the last command executed.  The resulting command is executed after the optional substitution old=new is performed.
jobs [ -lnp ] [ job ... ] Lists information about each given job; or all active jobs if job is omitted.  The -l option lists process ids in addition to the normal information.  The -n option only displays jobs that have stopped or exited since last notified.  The -p option causes only the process group to be listed.  See Jobs for a description of the format of job.
kill [ -s signame  ] [ -q  n  ] job ... kill [ -n signum ] [ -q n  ] job ... kill -Ll  [ sig ... ] Sends either the TERM (terminate) signal or the specified signal to the specified jobs or processes.  Signals are either given by number with the -n option or by name with the -s option (as given in <signal.h>, stripped of the prefix ``SIG'' with the exception that SIGCLD is named CHLD).  For backward compatibility, the n and s can be omitted and the number or name placed immediately after the -.  If the signal being sent is TERM (terminate) or HUP (hangup), then the job or process will be sent a CONT (continue) signal if it is stopped.  The argument job can be the process id of a process that is not a member of one of the active jobs.  See Jobs for a description of the format of job.  In the third form, kill -l, or kill -L, if sig is not specified, the signal names are listed.  The -l option list only the signal names.  -L options lists each signal name and corresponding number.  Otherwise, for each sig that is a name, the corresponding signal number is listed.  For each sig that is a number, the signal name corresponding to the least significant 8 bits of sig is listed. On systems that support sigqueue(2) the -q option can be used to send a queued signal with message number n.  Each specified job must be a positive number.  On systems that do not support sigqueue(2), a signal is sent without the message number n and the signal will not be queued.  If the signal cannot be queued because of a return of EAGAIN, the exit status will be 2.
let arg ... Each arg is a separate arithmetic expression to be evaluated.  let only recognizes octal constants starting with 0 when the set option letoctal is on.  See Arithmetic Evaluation above, for a description of arithmetic expression evaluation. The exit status is 0 if the value of the last expression is non- zero, and 1 otherwise.
† newgrp [ arg ... ] Equivalent to exec /bin/newgrp arg ....
print [ -CRenprsv ] [ -u unit] [ -f format ] [ arg ... ] With no options or with option - or --, each arg is printed on standard output.  The -f option causes the arguments to be printed as described by printf.  In this case, any e, n, r, R options are ignored.  Otherwise, unless the -C, -R, -r, or -v are specified, the following escape conventions will be applied: \a     The alert character (ascii 07). \b     The backspace character (ascii 010). \c     Causes print to end without processing more arguments and not adding a new-line. \f     The formfeed character (ascii 014). \n     The new-line character (ascii 012). \r     The carriage return character (ascii 015). \t     The tab character (ascii 011). \v     The vertical tab character (ascii 013). \E     The escape character (ascii 033). \\     The backslash character \. \0x    The character defined by the 1, 2, or 3-digit octal string given by x.
The -R option will print all subsequent arguments and options other than -n.  The -e causes the above escape conventions to be applied.  This is the default behavior.  It reverses the effect of an earlier -r.  The -p option causes the arguments to be written onto the pipe of the process spawned with ⎪& instead of standard output.  The -v option treats each arg as a variable name and writes the value in the printf %B format.  The -C option treats each arg as a variable name and writes the value in the printf %#B format.  The -s option causes the arguments to be written onto the history file instead of standard output.  The -u option can be used to specify a one digit file descriptor unit number unit on which the output will be placed.  The default is 1.  If the option -n is used, no new-line is added to the output.
printf [ -v varname ] format [ arg ... ] The arguments arg are printed on standard output in accordance with the ANSI-C formatting rules associated with the format string format.  If the number of arguments exceeds the number of format specifications, the format string is reused to format remaining arguments.  If the -v option is specified the output is assigned to the variable varname.  The following extensions can also be used: %b     A %b format can be used instead of %s to cause escape sequences in the corresponding arg to be expanded as described in print. %B     A %B option causes each of the arguments to be treated as variable names and the binary value of variable will be printed.  The alternate flag # causes a compound variable to be output on a single line.  This is most useful for compound variables and variables whose attribute is -b. %H     A %H format can be used instead of %s to cause characters in arg that are special in HTML and XML to be output as their entity name.  The alternate flag # formats the output for use as a URI. %P     A %P format can be used instead of %s to cause arg to be interpreted as an extended regular expression and be printed as a shell pattern. %R     A %R format can be used instead of %s to cause arg to be interpreted as a shell pattern and to be printed as an extended regular expression. %q     A %q format can be used instead of %s to cause the resulting string to be quoted in a manner than can be reinput to the shell.  When q is preceded by the alternative format specifier, #, the string is quoted in manner suitable as a field in a .csv format file. %(date-format)T A %(date-format)T format can be use to treat an argument as a date/time string and to format the date/time according to the date-format as defined for the date(1) command.  Values specified as digits are interpreted as described in the touch(1) command. %Z     A %Z format will output a byte whose value is 0. %d     The precision field of the %d format can be followed by a . and the output base.  In this case, the # flag character causes base# to be prepended. #      The # flag, when used with the %d format without an output base, displays the output in powers of 1000 indicated by one of the following suffixes: k M G T P E, and when used with the %i format displays the output in powers of 1024 indicated by one of the following suffixes: Ki Mi Gi Ti Pi Ei. =      The = flag centers the output within the specified field width. L      The L flag, when used with the %c or %s formats, treats precision as character width instead of byte count. ,      The , flag, when used with the %d or %f formats, separates groups of digits with the grouping delimiter (, on groups of 3 in the C locale.)
pwd [ -LP ] [ -f fd ] Outputs the value of the current working directory.  The -L option is the default; it prints the logical name of the current directory.  If the -P option is given, all symbolic links are resolved from the name.  The last instance of -L or -P on the command line determines which method is used.  If the -f option is specified, the directory name corresponding to file descriptor fd is outputted.
read [ -AaCSprsv ] [ -d delim] [ -n n] [ -N n] [ -m method] [ -t timeout] [ -u unit] [ vname?prompt ] [ vname ... ] The shell input mechanism.  One line is read and is broken up into fields using the characters in IFS as separators.  The escape character, \, is used to remove any special meaning for the next character and for line continuation.  The -d option causes the read to continue to the first character of delim rather than new- line.  The -n option causes at most n bytes to read rather a full line but will return when reading from a slow device as soon as any characters have been read.  The -N option causes exactly n to be read unless an end-of-file has been encountered or the read times out because of the -t option.  In raw mode, -r, the \ character is not treated specially.  The first field is assigned to the first vname, the second field to the second vname, etc., with leftover fields assigned to the last vname.  When vname has the binary attribute and -n or -N is specified, the bytes that are read are stored directly into the variable.  If the -v is specified, then the value of the first vname will be used as a default value when reading from a terminal device.  The -A option causes the variable vname to be unset and each field that is read to be stored in successive elements of the indexed array vname. -a is an alias for -A.  The -m option reads a compound variable with the read method defined by method.  Currently, only the json and ksh methods exist.  The -C option causes the variable vname to be read as a compound variable.  Blanks will be ignored when finding the beginning open parenthesis.  This is equivalent to -m ksh.  The -S option causes the line to be treated like a record in a .csv format file so that double quotes can be used to allow the delimiter character and the new-line character to appear within a field.  The -p option causes the input line to be taken from the input pipe of a process spawned by the shell using ⎪&.  If the -s option is present, the input will be saved as a command in the history file.  The option -u can be used to specify a one digit file descriptor unit unit to read from.  The file descriptor can be opened with the exec special built-in command.  The default value of unit n is 0.  The option -t is used to specify a timeout in seconds when reading from a terminal or pipe.  If vname is omitted, then REPLY is used as the default vname.  An end-of-file with the -p option causes cleanup for this process so that another can be spawned.  If the first argument contains a ?, the remainder of this word is used as a prompt on standard error when the shell is interactive.  The exit status is 0 unless an end-of-file is encountered or read has timed out.
†† readonly [ -p ] [ vname[=value] ] ... If vname is not given, the names and values of each variable with the readonly attribute is printed with the values quoted in a manner that allows them to be re-inputted.  The -p option causes the word readonly to be inserted before each one.  Otherwise, the given vnames are marked readonly and these names cannot be changed by subsequent assignment.  When defining a type, if the value of a readonly sub-variable is not defined the value is required when creating each instance.
† return [ n ] Causes a shell function or .  script to return to the invoking script with the exit status specified by n.  The value will be the least significant 8 bits of the specified status.  If n is omitted, then the return status is that of the last command executed.  If return is invoked while not in a function or a . script, then it behaves the same as exit.
As an obsolete feature, if the first arg is - then the -x and -v options are turned off and the next arg is treated as the first argument.  Using + rather than - causes these options to be turned off.  These options can also be used upon invocation of the shell. The current set of options may be found in $-.  Unless -A is specified, the remaining arguments are positional parameters and are assigned, in order, to $1 $2 ....  If no arguments are given, then the names and values of all variables are printed on the standard output.
† shift [ n ] The positional parameters from $n+1 ...  are renamed $1 ... , default n is 1.  The parameter n can be any arithmetic expression that evaluates to a non-negative number less than or equal to $#.
sleep seconds Suspends execution for the number of decimal seconds or fractions of a second given by seconds.  seconds A suffix of one of smhd can be used to indicate seconds, minutes, hours, and days respectively.  Seconds can also be specified using a date/time format.
times  Display CPU time used by the shell and all of its child processes.
† trap [ -alp ] [ action ] [ sig ] ... The -p option causes the trap action associated with each trap as specified by the arguments to be printed with appropriate quoting. Otherwise, action will be processed as if it were an argument to eval when the shell receives signal(s) sig. The -a option causes the current trap setting to be appended to action.  Each sig can be given as a number or as the name of the signal.  Trap commands are executed in order of signal number. Any attempt to set a trap on a signal that was ignored on entry to the current shell is ineffective.  If action is omitted and the first sig is a number, or if action is -, then the trap(s) for each sig are reset to their original values.  If action is the null string then this signal is ignored by the shell and by the commands it invokes. If sig is ERR then action will be executed whenever a command has a non-zero exit status. If sig is DEBUG then action will be executed before each command. The variable .sh.command will contain the contents of the current command line when action is running.  If the exit status of the trap is 2 the command will not be executed.  If the exit status of the trap is 255 and inside a function or a dot script, the function or dot script will return. If sig is 0 or EXIT and the trap statement is executed inside the body of a function defined with the function name syntax, then the command action is executed after the function completes.  For a trap set outside any function then the command action is executed on exit from the shell. If sig is KEYBD, then action will be executed whenever a key is read while in emacs, gmacs, or vi mode.  The trap command with no arguments prints a list of commands associated with each signal number. An exit or return without an argument in a trap action will preserve the exit status of the command that invoked the trap. action.  Each sig can be given as a number or as the name of the signal.  Trap commands are executed in order of signal number. Any attempt to set a trap on a signal that was ignored on entry to the current shell is ineffective.  If action is omitted and the first sig is a number, or if action is -, then the trap(s) for each sig are reset to their original values.  The -l option lists the signals and their numbers to standard output.
true   Does nothing, and exits 0. Used with while for infinite loops.
The -i attribute cannot be specified along with -R, -L, -Z, or -f.
Using + rather than - causes these options to be turned off.  If no vname arguments are given, a list of vnames (and optionally the values) of the variables is printed.  (Using + rather than - keeps the values from being printed.)  The -p option causes typeset followed by the option letters to be printed before each name rather than the names of the options.  If any option other than -p is given, only those variables which have all of the given options are printed.  Otherwise, the vnames and attributes of all variables that have attributes are printed.
ulimit [ -HSacdfmnpstv ] [ limit ] Set or display a resource limit.  The available resource limits are listed below.  Many systems do not support one or more of these limits.  The limit for a specified resource is set when limit is specified.  The value of limit can be a number in the unit specified below with each resource, or the value unlimited. The -H and -S options specify whether the hard limit or the soft limit for the given resource is set.  A hard limit cannot be increased once it is set.  A soft limit can be increased up to the value of the hard limit.  If neither the H nor S option is specified, the limit applies to both.  The current resource limit is printed when limit is omitted.  In this case, the soft limit is printed unless H is specified.  When more than one resource is specified, then the limit name and unit is printed before the value. -a     Lists all of the current resource limits. -c     The number of 512-byte blocks on the size of core dumps. -d     The number of K-bytes on the size of the data area. -f     The number of 512-byte blocks on files that can be written by the current process or by child processes (files of any size may be read). -m     The number of K-bytes on the size of physical memory. -n     The number of file descriptors plus 1. -p     The number of 512-byte blocks for pipe buffering. -s     The number of K-bytes on the size of the stack area. -t     The number of CPU seconds to be used by each process. -v     The number of K-bytes for virtual memory.
If no option is given, -f is assumed.
umask [ -pS ] [ mask ] The user file-creation mask is set to mask (see umask(2)).  mask can either be an octal number or a symbolic value as described in chmod(1).  If a symbolic value is given, the new umask value is the complement of the result of applying mask to the complement of the previous umask value.  If mask is omitted, the current value of the mask is printed.  The -S option causes the mode to be printed as a symbolic value.  Otherwise, the mask is printed in octal.  The -p option cause the output to be in a form that can be use for reinput.
† unalias [ -a ] name ... The aliases given by the list of names are removed from the alias list.  The -a option causes all the aliases to be unset.
†unset [ -fnv ] vname ... The variables given by the list of vnames are unassigned, i.e., except for sub-variables within a type, their values and attributes are erased.  For sub-variables of a type, the values are reset to the default value from the type definition.  Readonly variables cannot be unset.  If the -f option is set, then the names refer to function names.  If the -v option is set, then the names refer to variable names.  The -f option overrides -v.  If -n is set and name is a name reference, then name will be unset rather than the variable that it references.  The default is equivalent to -v.  Unsetting LINENO, MAILCHECK, OPTARG, OPTIND, RANDOM, SECONDS, TMOUT, and _ removes their special meaning even if they are subsequently assigned to.
wait [ job ... ] Wait for the specified job and report its termination status.  If job is not given, then all currently active child processes are waited for.  The exit status from this command is that of the last process waited for if job is specified; otherwise it is zero.  See Jobs for a description of the format of job.
whence [ -afpv ] name ... For each name, indicate how it would be interpreted if used as a command name. The -v option produces a more verbose report.  The -f option skips the search for functions.  The -p option does a path search for name even if name is an alias, a function, or a reserved word. The -p option turns off the -v option.  The -a option is similar to the -v option but causes all interpretations of the given name to be reported.
Invocation. If the shell is invoked by exec(2), and the first character of argument zero ($0) is -, then the shell is assumed to be a login shell and commands are read from /etc/profile and then from $HOME/.profile, if it exists.  Alternatively, the option -l causes the shell to a treated as a login shell.  Next, for interactive shells, commands are read from the file named by performing parameter expansion, command substitution, and arithmetic substitution on the value of the environment variable ENV if the file exists.  If the -s option is not present and arg and a file by the name of arg exists, then it reads and executes this script. Otherwise, if the first arg does not contain a /, a path search is performed on the first arg to determine the name of the script to execute.  The script arg must have execute permission and any setuid and setgid settings will be ignored.  If the script is not found on the path, arg is processed as if it named a built-in command or function.  Commands are then read as described below; the following options are interpreted by the shell when it is invoked:
-D      A list of all double quoted strings that are preceded by a $ will be printed on standard output and the shell will exit.  This set of strings will be subject to language translation when the locale is not C or POSIX.  No commands will be executed.
-E      Reads the file named by the ENV variable or by $HOME/.kshrc if not defined after the profiles.
-c      If the -c option is present, then commands are read from the first arg.  Any remaining arguments become positional parameters starting at 0.
-s      If the -s option is present or if no arguments remain, then commands are read from the standard input.  Shell output, except for the output of the Special Commands listed above, is written to file descriptor 2.
-i      If the -i option is present or if the shell input and error output are attached to a terminal (as told by tcgetattr(2)), then this shell is interactive.  In this case TERM is ignored (so that kill 0 does not kill an interactive shell) and INTR is caught and ignored (so that wait is interruptible).  In all cases, QUIT is ignored by the shell.
-r      If the -r option is present, the shell is a restricted shell.
-P      If -P or -o profile is present, the shell is a profile shell (see pfexec(1)).
-R filename The -R filename option is used to generate a cross reference database that can be used by a separate utility to find definitions and references for variables and commands.  The filename argument specifies the generated database. A script file must be provided on the command line as well.
The remaining options and arguments are described under the set command above.  An optional - as the first argument is ignored.
Rksh Only. Rksh is used to set up login names and execution environments whose capabilities are more controlled than those of the standard shell.  The actions of rksh are identical to those of ksh, except that the following are disallowed: Unsetting the restricted option. changing directory (see cd(1)), setting or unsetting the value or attributes of SHELL, ENV, FPATH, or PATH, specifying path or command names containing /, redirecting output (>, >|, <>, and >>). adding or deleting built-in commands. using command -p to invoke a command.
The restrictions above are enforced after .profile and the ENV files are interpreted.
When a command to be executed is found to be a shell procedure, rksh invokes ksh to execute it.  Thus, it is possible to provide to the end- user shell procedures that have access to the full power of the standard shell, while imposing a limited menu of commands; this scheme assumes that the end-user does not have write and execute permissions in the same directory.
The net effect of these rules is that the writer of the .profile has complete control over user actions, by performing guaranteed setup actions and leaving the user in an appropriate directory (probably not the login directory).
The system administrator often sets up a directory of commands (e.g., /usr/rbin) that can be safely invoked by rksh.
Errors detected by the shell, such as syntax errors, cause the shell to return a non-zero exit status.  If the shell is being used non- interactively, then execution of the shell file is abandoned unless the error occurs inside a subshell in which case the subshell is abandoned. Otherwise, the shell returns the exit status of the last command executed (see also the exit command above).  Run time errors detected by the shell are reported by printing the command or function name and the error condition.  If the line number that the error occurred on is greater than one, then the line number is also printed in square brackets ([]) after the command or function name.
/etc/profile The system wide initialization file, executed for login shells.
$HOME/.profile The personal initialization file, executed for login shells after /etc/profile.
$HOME/.kshrc Default personal initialization file, executed for interactive shells when ENV is not set.
/etc/suid_profile Alternative initialization file, executed instead of the personal initialization file when the real and effective user or group id do not match.
/dev/null NULL device
cat(1), cd(1), chmod(1), cut(1), date(1), egrep(1), echo(1), emacs(1), env(1), fgrep(1), gmacs(1), grep(1), newgrp(1), pfexec(1), stty(1), test(1), touch(1), umask(1), vi(1), dup(2), exec(2), fork(2), getpwnam(3), ioctl(2), lseek(2), paste(1), pathconf(2), pipe(2), sigsetinfo(2), sysconf(2), umask(2), ulimit(2), wait(2), wctrans(3), rand(3), a.out(5), profile(5), environ(7).
Morris I. Bolsky and David G. Korn, The New KornShell Command and Programming Language, Prentice Hall, 1995.
POSIX - Part 2: Shell and Utilities, IEEE Std 1003.2-1992, ISO/IEC 9945-2, IEEE, 1993.
If a command is executed, and then a command with the same name is installed in a directory in the search path before the directory where the original command was found, the shell will continue to exec the original command.  Use the -t option of the alias command to correct this situation.
Some very old shell scripts contain a ^ as a synonym for the pipe character ⎪.
Using the hist built-in command within a compound command will cause the whole command to disappear from the history file.
The built-in command . file reads the whole file before any commands are executed.  Therefore, alias and unalias commands in the file will not apply to any commands defined in the file.
Traps are not processed while a job is waiting for a foreground process. Thus, a trap on CHLD won't be executed until the foreground job terminates.
It is a good idea to leave a space after the comma operator in arithmetic expressions to prevent the comma from being interpreted as the decimal point character in certain locales.
GIT-SUBMODULE(1)                   Git Manual                   GIT-SUBMODULE(1)
git-submodule - Initialize, update or inspect submodules
git submodule [--quiet] [--cached] git submodule [--quiet] add [<options>] [--] <repository> [<path>] git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...] git submodule [--quiet] init [--] [<path>...] git submodule [--quiet] deinit [-f|--force] (--all|[--] <path>...) git submodule [--quiet] update [<options>] [--] [<path>...] git submodule [--quiet] set-branch [<options>] [--] <path> git submodule [--quiet] set-url [--] <path> <newurl> git submodule [--quiet] summary [<options>] [--] [<path>...] git submodule [--quiet] foreach [--recursive] <command> git submodule [--quiet] sync [--recursive] [--] [<path>...] git submodule [--quiet] absorbgitdirs [--] [<path>...]
Inspects, updates and manages submodules.
For more information about submodules, see gitsubmodules(7).
With no arguments, shows the status of existing submodules. Several subcommands are available to perform operations on the submodules.
add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--depth <depth>] [--] <repository> [<path>] Add the given repository as a submodule at the given path to the changeset to be committed next to the current project: the current project is termed the "superproject".
<repository> is the URL of the new submodule’s origin repository. This may be either an absolute URL, or (if it begins with ./ or ../), the location relative to the superproject’s default remote repository (Please note that to specify a repository foo.git which is located right next to a superproject bar.git, you’ll have to use ../foo.git instead of ./foo.git - as one might expect when following the rules for relative URLs - because the evaluation of relative URLs in Git is identical to that of relative directories).
The default remote is the remote of the remote-tracking branch of the current branch. If no such remote-tracking branch exists or the HEAD is detached, "origin" is assumed to be the default remote. If the superproject doesn’t have a default remote configured the superproject is its own authoritative upstream and the current working directory is used instead.
The optional argument <path> is the relative location for the cloned submodule to exist in the superproject. If <path> is not given, the canonical part of the source repository is used ("repo" for "/path/to/repo.git" and "foo" for "host.xz:foo/.git"). If <path> exists and is already a valid Git repository, then it is staged for commit without cloning. The <path> is also used as the submodule’s logical name in its configuration entries unless --name is used to specify a logical name.
The given URL is recorded into .gitmodules for use by subsequent users cloning the superproject. If the URL is given relative to the superproject’s repository, the presumption is the superproject and submodule repositories will be kept together in the same relative location, and only the superproject’s URL needs to be provided. git-submodule will correctly locate the submodule using the relative URL in .gitmodules.
status [--cached] [--recursive] [--] [<path>...] Show the status of the submodules. This will print the SHA-1 of the currently checked out commit for each submodule, along with the submodule path and the output of git describe for the SHA-1. Each SHA-1 will possibly be prefixed with - if the submodule is not initialized, + if the currently checked out submodule commit does not match the SHA-1 found in the index of the containing repository and U if the submodule has merge conflicts.
If --cached is specified, this command will instead print the SHA-1 recorded in the superproject for each submodule.
If --recursive is specified, this command will recurse into nested submodules, and show their status as well.
If you are only interested in changes of the currently initialized submodules with respect to the commit recorded in the index or the HEAD, git-status(1) and git-diff(1) will provide that information too (and can also report changes to a submodule’s work tree).
init [--] [<path>...] Initialize the submodules recorded in the index (which were added and committed elsewhere) by setting submodule.$name.url in .git/config. It uses the same setting from .gitmodules as a template. If the URL is relative, it will be resolved using the default remote. If there is no default remote, the current repository will be assumed to be upstream.
Optional <path> arguments limit which submodules will be initialized. If no path is specified and submodule.active has been configured, submodules configured to be active will be initialized, otherwise all submodules are initialized.
When present, it will also copy the value of submodule.$name.update. This command does not alter existing information in .git/config. You can then customize the submodule clone URLs in .git/config for your local setup and proceed to git submodule update; you can also just use git submodule update --init without the explicit init step if you do not intend to customize any submodule locations.
See the add subcommand for the definition of default remote.
deinit [-f|--force] (--all|[--] <path>...) Unregister the given submodules, i.e. remove the whole submodule.$name section from .git/config together with their work tree. Further calls to git submodule update, git submodule foreach and git submodule sync will skip any unregistered submodules until they are initialized again, so use this command if you don’t want to have a local checkout of the submodule in your working tree anymore.
When the command is run without pathspec, it errors out, instead of deinit-ing everything, to prevent mistakes.
If --force is specified, the submodule’s working tree will be removed even if it contains local modifications.
If you really want to remove a submodule from the repository and commit that use git-rm(1) instead. See gitsubmodules(7) for removal options.
update [--init] [--remote] [-N|--no-fetch] [--[no-]recommend-shallow] [-f|--force] [--checkout|--rebase|--merge] [--reference <repository>] [--depth <depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--] [<path>...] Update the registered submodules to match what the superproject expects by cloning missing submodules, fetching missing commits in submodules and updating the working tree of the submodules. The "updating" can be done in several ways depending on command line options and the value of submodule.<name>.update configuration variable. The command line option takes precedence over the configuration variable. If neither is given, a checkout is performed. The update procedures supported both from the command line as well as through the submodule.<name>.update configuration are:
checkout the commit recorded in the superproject will be checked out in the submodule on a detached HEAD.
If --force is specified, the submodule will be checked out (using git checkout --force), even if the commit specified in the index of the containing repository already matches the commit checked out in the submodule.
rebase the current branch of the submodule will be rebased onto the commit recorded in the superproject.
merge the commit recorded in the superproject will be merged into the current branch in the submodule.
The following update procedures are only available via the submodule.<name>.update configuration variable:
custom command arbitrary shell command that takes a single argument (the sha1 of the commit recorded in the superproject) is executed. When submodule.<name>.update is set to !command, the remainder after the exclamation mark is the custom command.
none the submodule is not updated.
If the submodule is not yet initialized, and you just want to use the setting as stored in .gitmodules, you can automatically initialize the submodule with the --init option.
If --recursive is specified, this command will recurse into the registered submodules, and update any nested submodules within.
set-branch (-b|--branch) <branch> [--] <path>, set-branch (-d|--default) [--] <path> Sets the default remote tracking branch for the submodule. The --branch option allows the remote branch to be specified. The --default option removes the submodule.<name>.branch configuration key, which causes the tracking branch to default to the remote HEAD.
set-url [--] <path> <newurl> Sets the URL of the specified submodule to <newurl>. Then, it will automatically synchronize the submodule’s new remote URL configuration.
summary [--cached|--files] [(-n|--summary-limit) <n>] [commit] [--] [<path>...] Show commit summary between the given commit (defaults to HEAD) and working tree/index. For a submodule in question, a series of commits in the submodule between the given super project commit and the index or working tree (switched by --cached) are shown. If the option --files is given, show the series of commits in the submodule between the index of the super project and the working tree of the submodule (this option doesn’t allow to use the --cached option or to provide an explicit commit).
Using the --submodule=log option with git-diff(1) will provide that information too.
foreach [--recursive] <command> Evaluates an arbitrary shell command in each checked out submodule. The command has access to the variables $name, $sm_path, $displaypath, $sha1 and $toplevel: $name is the name of the relevant submodule section in .gitmodules, $sm_path is the path of the submodule as recorded in the immediate superproject, $displaypath contains the relative path from the current working directory to the submodules root directory, $sha1 is the commit as recorded in the immediate superproject, and $toplevel is the absolute path to the top-level of the immediate superproject. Note that to avoid conflicts with $PATH on Windows, the $path variable is now a deprecated synonym of $sm_path variable. Any submodules defined in the superproject but not checked out are ignored by this command. Unless given --quiet, foreach prints the name of each submodule before evaluating the command. If --recursive is given, submodules are traversed recursively (i.e. the given shell command is evaluated in nested submodules as well). A non-zero return from the command in any submodule causes the processing to terminate. This can be overridden by adding || : to the end of the command.
As an example, the command below will show the path and currently checked out commit for each submodule:
git submodule foreach 'echo $sm_path `git rev-parse HEAD`'
sync [--recursive] [--] [<path>...] Synchronizes submodules' remote URL configuration setting to the value specified in .gitmodules. It will only affect those submodules which already have a URL entry in .git/config (that is the case when they are initialized or freshly added). This is useful when submodule URLs change upstream and you need to update your local repositories accordingly.
git submodule sync synchronizes all submodules while git submodule sync -- A synchronizes submodule "A" only.
If --recursive is specified, this command will recurse into the registered submodules, and sync any nested submodules within.
absorbgitdirs If a git directory of a submodule is inside the submodule, move the git directory of the submodule into its superproject’s $GIT_DIR/modules path and then connect the git directory and its working directory by setting the core.worktree and adding a .git file pointing to the git directory embedded in the superprojects git directory.
A repository that was cloned independently and later added as a submodule or old setups have the submodules git directory inside the submodule instead of embedded into the superprojects git directory.
This command is recursive by default.
-q, --quiet Only print error messages.
--progress This option is only valid for add and update commands. Progress status is reported on the standard error stream by default when it is attached to a terminal, unless -q is specified. This flag forces progress status even if the standard error stream is not directed to a terminal.
--all This option is only valid for the deinit command. Unregister all submodules in the working tree.
-b <branch>, --branch <branch> Branch of repository to add as submodule. The name of the branch is recorded as submodule.<name>.branch in .gitmodules for update --remote. A special value of .  is used to indicate that the name of the branch in the submodule should be the same name as the current branch in the current repository. If the option is not specified, it defaults to the remote HEAD.
-f, --force This option is only valid for add, deinit and update commands. When running add, allow adding an otherwise ignored submodule path. When running deinit the submodule working trees will be removed even if they contain local changes. When running update (only effective with the checkout procedure), throw away local changes in submodules when switching to a different commit; and always run a checkout operation in the submodule, even if the commit listed in the index of the containing repository matches the commit checked out in the submodule.
--cached This option is only valid for status and summary commands. These commands typically use the commit found in the submodule HEAD, but with this option, the commit stored in the index is used instead.
--files This option is only valid for the summary command. This command compares the commit in the index with that in the submodule HEAD when this option is used.
-n, --summary-limit This option is only valid for the summary command. Limit the summary size (number of commits shown in total). Giving 0 will disable the summary; a negative number means unlimited (the default). This limit only applies to modified submodules. The size is always limited to 1 for added/deleted/typechanged submodules.
--remote This option is only valid for the update command. Instead of using the superproject’s recorded SHA-1 to update the submodule, use the status of the submodule’s remote-tracking branch. The remote used is branch’s remote (branch.<name>.remote), defaulting to origin. The remote branch used defaults to the remote HEAD, but the branch name may be overridden by setting the submodule.<name>.branch option in either .gitmodules or .git/config (with .git/config taking precedence).
This works for any of the supported update procedures (--checkout, --rebase, etc.). The only change is the source of the target SHA-1. For example, submodule update --remote --merge will merge upstream submodule changes into the submodules, while submodule update --merge will merge superproject gitlink changes into the submodules.
In order to ensure a current tracking branch state, update --remote fetches the submodule’s remote repository before calculating the SHA-1. If you don’t want to fetch, you should use submodule update --remote --no-fetch.