Difference between revisions of "Bash Builtin Commands"
(One intermediate revision by one user not shown) | |||
Line 2: | Line 2: | ||
alias, bg, bind, break, builtin, caller, cd, command, compgen, complete, compopt, continue, declare, dirs, disown, echo, enable, eval, exec, exit, export, false, fc, fg, getopts, hash, help, history, jobs, kill, let, local, logout, mapfile, popd, printf, pushd, pwd, read, readonly, return, set, shift, shopt, source, suspend, test, times, trap, true, type, typeset, ulimit, umask, unalias, unset, wait | alias, bg, bind, break, builtin, caller, cd, command, compgen, complete, compopt, continue, declare, dirs, disown, echo, enable, eval, exec, exit, export, false, fc, fg, getopts, hash, help, history, jobs, kill, let, local, logout, mapfile, popd, printf, pushd, pwd, read, readonly, return, set, shift, shopt, source, suspend, test, times, trap, true, type, typeset, ulimit, umask, unalias, unset, wait | ||
+ | |||
+ | == alias == | ||
+ | |||
+ | Create an alias, aliases allow a string to be substituted for a word when it is used as the first word of a simple command. | ||
+ | |||
+ | == break == | ||
+ | |||
+ | The break statement is used to exit the current loop before its normal ending. This is done when you don't know in advance how many times the loop will have to execute, for instance because it is dependent on user input. | ||
+ | |||
+ | == cd == | ||
+ | |||
+ | Change directory | ||
+ | |||
+ | == echo == | ||
== printf == | == printf == | ||
Line 14: | Line 28: | ||
printf "%s\n" "Hello World" | printf "%s\n" "Hello World" | ||
+ | see: [[printf bash builtin]] | ||
− | + | {{:Sparse Entry}} | |
− | + | ||
[[Category:Computer_Technology]] | [[Category:Computer_Technology]] | ||
[[Category:Linux]] | [[Category:Linux]] |
Latest revision as of 13:51, 9 February 2014
Bash has several commands that are built inside the command shell. When the name of a builtin command is used as the first word of a simple command, the shell executes the command directly, without invoking another program. Builtin commands are necessary to implement functionality impossible or inconvenient to obtain with separate utilities. Many of the builtins have been extended by POSIX or Bash.
alias, bg, bind, break, builtin, caller, cd, command, compgen, complete, compopt, continue, declare, dirs, disown, echo, enable, eval, exec, exit, export, false, fc, fg, getopts, hash, help, history, jobs, kill, let, local, logout, mapfile, popd, printf, pushd, pwd, read, readonly, return, set, shift, shopt, source, suspend, test, times, trap, true, type, typeset, ulimit, umask, unalias, unset, wait
alias
Create an alias, aliases allow a string to be substituted for a word when it is used as the first word of a simple command.
break
The break statement is used to exit the current loop before its normal ending. This is done when you don't know in advance how many times the loop will have to execute, for instance because it is dependent on user input.
cd
Change directory
echo
printf
The printf command provides a method to print pre-formatted text, expanding shells script standard output over the echo command. See format and example below:
printf <FORMAT> <ARGUMENTS...> printf "Last name: %s\nName: %s\n" "$SURNAME" "$LASTNAME"
the printf does not automatically line feed unlike the echo command. LF is not implied, it must be stated. See two equivalents below:
echo "Hello World" printf "Hello World\n" printf "%s\n" "Hello World"
see: printf bash builtin
Note: This page is notably incomplete. You can help. Please contribute by registering your email address and adding your knowledge to this page. The D.U.C.K. wiki was created to be a free informative place that allows an open exchange of accurate information. Learn more... |