Differences between revisions 3 and 7 (spanning 4 versions)
Revision 3 as of 2023-01-25 20:48:41
Size: 2174
Comment:
Revision 7 as of 2023-01-25 21:12:45
Size: 2955
Comment:
Deletions are marked like this. Additions are marked like this.
Line 45: Line 45:
Execute a builtin command. This is only useful when reimplementing a builtin but still need to call the original builtin within the function.
Line 71: Line 73:
Execute a command. This can be useful to call a command when there is a function with the same name. It can also be 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
}}}
Line 77: Line 88:
See [[Bash/Completion|here]].
Line 83: Line 96:
See [[Bash/Completion|here]].
Line 89: Line 104:
See [[Bash/Completion|here]].
Line 143: Line 160:
If used in an interactive shell, or when used in a script that is `source`d, causes the shell session to exit.
Line 245: Line 264:
Prints the current working directory.
Line 269: Line 290:
Only valid within a function definition. See [[Bash/Function#Error_and_Return_Codes|here]].

Builtin Commands


:

Does nothing; arguments passed to it are expanded but immediately discarded.


Alias

See here.


Bg


Bind


Break


Builtin

Execute a builtin command. This is only useful when reimplementing a builtin but still need to call the original builtin within the function.


Caller


Cd

Change the current working directory to a new path. Can be a relative or absolute path, as well as the special . and .. directories.

Note the rules for tilde expansion when using the ~ symbol here.

cd - changes the current working directory to the previous working directory.

There is also special behavior around specifying nothing. cd is the same as cd ~.


Command

Execute a command. This can be useful to call a command when there is a function with the same name. It can also be 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


CompGen

See here.


Complete

See here.


CompOpt

See here.


Continue


Declare


Dirs


Disown


Echo


Enable


Eval


Exec


Exit

If used in an interactive shell, or when used in a script that is sourced, causes the shell session to exit.


Export


Fc


Fg


GetOpts


Hash


Help


History


Jobs


Kill


Let


Local


LogOut


MapFile


PopD


PrintF


PushD


Pwd

Prints the current working directory.


Read


ReadArray


ReadOnly


Return

Only valid within a function definition. See here.


Set

See here.


Shift


ShOpt

See here.


Source

Aliased to ..


Test

Aliased to [.

See here.


Time


Trap


TypeSet


UnAlias


UnSet


Wait


CategoryRicottone

Bash/BuiltinCommands (last edited 2023-01-30 01:04:28 by DominicRicottone)