Skip to content

Instantly share code, notes, and snippets.

@mattintosh4
Last active August 29, 2015 14:23
Show Gist options
  • Save mattintosh4/d4d3cbd5d9fc43a67595 to your computer and use it in GitHub Desktop.
Save mattintosh4/d4d3cbd5d9fc43a67595 to your computer and use it in GitHub Desktop.
$ enable -a
enable .
enable :
enable [
enable alias
enable bg
enable bind
enable break
enable builtin
enable caller
enable cd
enable command
enable compgen
enable complete
enable compopt
enable continue
enable declare
enable dirs
enable disown
enable echo
enable enable
enable eval
enable exec
enable exit
enable export
enable false
enable fc
enable fg
enable getopts
enable hash
enable help
enable history
enable jobs
enable kill
enable let
enable local
enable logout
enable mapfile
enable popd
enable printf
enable pushd
enable pwd
enable read
enable readarray
enable readonly
enable return
enable set
enable shift
enable shopt
enable source
enable suspend
enable test
enable times
enable trap
enable true
enable type
enable typeset
enable ulimit
enable umask
enable unalias
enable unset
enable wait
$ help
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
A star (*) next to a name means that the command is disabled.
job_spec [&] history [-c] [-d offset] [n] or hist>
(( expression )) if COMMANDS; then COMMANDS; [ elif C>
. filename [arguments] jobs [-lnprs] [jobspec ...] or jobs >
: kill [-s sigspec | -n signum | -sigs>
[ arg... ] let arg [arg ...]
[[ expression ]] local [option] name[=value] ...
alias [-p] [name[=value] ... ] logout [n]
bg [job_spec ...] mapfile [-n count] [-O origin] [-s c>
bind [-lpsvPSVX] [-m keymap] [-f file> popd [-n] [+N | -N]
break [n] printf [-v var] format [arguments]
builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir]
caller [expr] pwd [-LP]
case WORD in [PATTERN [| PATTERN]...)> read [-ers] [-a array] [-d delim] [->
cd [-L|[-P [-e]] [-@]] [dir] readarray [-n count] [-O origin] [-s>
command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] o>
compgen [-abcdefgjksuv] [-o option] > return [n]
complete [-abcdefgjksuv] [-pr] [-DE] > select NAME [in WORDS ... ;] do COMM>
compopt [-o|+o option] [-DE] [name ..> set [-abefhkmnptuvxBCHP] [-o option->
continue [n] shift [n]
coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...]
declare [-aAfFgilnrtux] [-p] [name[=v> source filename [arguments]
dirs [-clpv] [+N] [-N] suspend [-f]
disown [-h] [-ar] [jobspec ...] test [expr]
echo [-neE] [arg ...] time [-p] pipeline
enable [-a] [-dnps] [-f filename] [na> times
eval [arg ...] trap [-lp] [[arg] signal_spec ...]
exec [-cl] [-a name] [command [argume> true
exit [n] type [-afptP] name [name ...]
export [-fn] [name[=value] ...] or ex> typeset [-aAfFgilrtux] [-p] name[=va>
false ulimit [-SHabcdefilmnpqrstuvxT] [lim>
fc [-e ename] [-lnr] [first] [last] o> umask [-p] [-S] [mode]
fg [job_spec] unalias [-a] name [name ...]
for NAME [in WORDS ... ] ; do COMMAND> unset [-f] [-v] [-n] [name ...]
for (( exp1; exp2; exp3 )); do COMMAN> until COMMANDS; do COMMANDS; done
function name { COMMANDS ; } or name > variables - Names and meanings of so>
getopts optstring name [arg] wait [-n] [id ...]
hash [-lr] [-p pathname] [-dt] [name > while COMMANDS; do COMMANDS; done
help [-dms] [pattern ...] { COMMANDS ; }
#!/bin/sh
save_PATH=${PATH}
which ls
unset PATH
which ls
PATH=${save_PATH}
type ls
unset PATH
type ls
/bin/ls
bash: line 6: which: No such file or directory
ls is /bin/ls
bash: line 11: type: ls: not found
#!/bin/bash
enable echo
printf '%s' "--- Builtin echo ---"
time for ((i = 0; i < 10000; i++))
do
echo >/dev/null
done
enable -n echo
printf '%s' "--- External echo ---"
time for ((i = 0; i < 10000; i++))
do
echo >/dev/null
done
--- Builtin echo ---
real 0m0.201s
user 0m0.157s
sys 0m0.042s
--- External echo ---
real 0m16.997s
user 0m4.888s
sys 0m11.593s
$ enable -s
enable .
enable :
enable break
enable continue
enable eval
enable exec
enable exit
enable export
enable readonly
enable return
enable set
enable shift
enable source
enable times
enable trap
enable unset
#!/bin/bash
### SYNOPSIS ###
# echo [SHORT-OPTION]... [STRING]...
# echo LONG-OPTION
PS4=$'\e[41;5m>>>\e[m '
set -x
echo "Hello, World!"
echo -n "do not output the trailing newline"
echo -e "enable interpretation of backslash escapes"
echo -E "disable interpretation of backslash escapes (default)"
echo --help
echo --version
/bin/echo --help
/bin/echo --version
#!/bin/bash
PS4=$'\e[41;5m>>>\e[m '
set -x
# builtin
echo --help
echo --version
# external (fullpath)
/bin/echo --help
/bin/echo --version
# external (disable builtin)
enable -n echo
echo --help
echo --version
$ alias ls="ls -alF --color=auto"
$ type ls
ls is aliased to `ls -alF --color=auto'
$ which ls
/bin/ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment