|
Size: 2872
Comment: Reorg
|
← Revision 4 as of 2025-12-19 20:19:12 ⇥
Size: 3180
Comment: Cleanup
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 14: | Line 14: |
| ||`.` || || || | ||`.` || || || |
| Line 21: | Line 21: |
| ||`dirs` || || || ||`disown` || || || ||`echo` || || || ||`enable` || || || |
||`dirs` || || || ||`disown` || || || ||`echo` || || || ||`enable` || || || |
| Line 29: | Line 29: |
| ||`fc` || || || ||`getopts` || || || ||`hash` || || || |
||`fc` || || || ||`getopts` || || || ||`hash` || || || |
| Line 33: | Line 33: |
| ||`history` || || || ||`kill` || || || |
||`history` || || || ||`kill` || || || |
| Line 36: | Line 36: |
| ||`mapfile` || || || ||`popd` || || || ||`printf` || || || ||`pushd` || || || |
||`mapfile` || || || ||`popd` || || || ||`printf` || || || ||`pushd` || || || |
| Line 41: | Line 41: |
| ||`read` || || || ||`readarray` || || || ||`readonly` || || || |
||`read` || || || ||`readarray` || || || ||`readonly` || || || |
| Line 47: | Line 47: |
| ||`time` || || || ||`trap` ||Creates a [[Shell/Trap|here]]|| || ||`typeset` || || || |
||`time` || || || ||`trap` ||Creates a trap || || ||`typeset` || || || |
| Line 52: | Line 52: |
| ||`wait` || || || | ||`wait` || || || |
Shell Builtin Commands
The set of portable commands.
Commands
Command |
Description |
Example |
. |
|
|
: |
No-op |
|
alias |
Creates an alias |
|
bind |
|
|
builtin |
Executes a builtin command |
|
cd |
Changes the current working directory |
|
command |
Executes a command |
|
dirs |
|
|
disown |
|
|
echo |
|
|
enable |
|
|
eval |
Executes a command |
|
exec |
Replaces the shell with a command |
|
exit |
Causes a script or shell to exit immediately |
|
export |
Marks one or more names as variables to be included in the environment of subsequently-called commands |
export varname="some value" |
fc |
|
|
getopts |
|
|
hash |
|
|
help |
Prints helpful information about a builtin command |
|
history |
|
|
kill |
|
|
logout |
Exits a login shell immediately |
|
mapfile |
|
|
popd |
|
|
printf |
|
|
pushd |
|
|
pwd |
Prints the current working directory |
|
read |
|
|
readarray |
|
|
readonly |
|
|
set |
Sets a shell option |
|
shift |
Renames the positional variables |
|
test |
Executes a test |
|
time |
|
|
trap |
Creates a trap |
|
typeset |
|
|
unalias |
Removes an alias |
|
unset |
Unsets a shell option |
|
wait |
|
|
Builtin
builtin can be useful to call a builtin command when there is a custom command with the same name.
Cd
Calling cd without an argument is the same as cd ~.
cd - changes the current working directory to the previous working directory.
Command
command can be useful to call a command when there is a function with the same name.
command is also commonly used to determine if a command is locally available.
if ! command -v mypy >/dev/null 2>&1; then echo "cannot locate mypy; is it installed?" exit fi
Reserved Keywords
Some parts of the language are technically implemented as a command.
See here for break and continue.
See here for return.
See here for bg, fg, and jobs.
