Pan*_*dya 28 command-line bash
我们知道 bash 支持许多 buitin 命令, 例如:
$ type type cd help command
type is a shell builtin
cd is a shell builtin
help is a shell builtin
command is a shell builtin
Run Code Online (Sandbox Code Playgroud)
我想获得所有可用的 shell 内置命令的列表。我如何通过命令行做到这一点?
kar*_*rel 21
从终端类型:
help
Run Code Online (Sandbox Code Playgroud)
来自help help:
Display information about builtin commands.
Run Code Online (Sandbox Code Playgroud)
Pan*_*dya 13
或者,您可以使用enable命令显示:(@karel 和 @steeldriver 的答案都很好。)
enable -a | cut -d " " -f 2,3
Run Code Online (Sandbox Code Playgroud)
如果任何内置函数被禁用,那么它会显示为-n输入输出。
示例输出:
$ enable -a | cut -d " " -f 2,3
.
:
[
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
readarray
readonly
return
set
shift
shopt
source
suspend
test
times
trap
true
type
typeset
ulimit
umask
unalias
unset
wait
Run Code Online (Sandbox Code Playgroud)