September 2018
Beginner
186 pages
4h 30m
English
The type command, given the name of any command or commands, gives you information about what kind of command it is:
bash$ type echo echo is a shell builtin bash$ type grep grep is /bin/grep
It identifies shell keyword, too:
bash$ type for for is a shell keyword
We can define a function and an alias to test that it correctly detects those:
bash$ myfunc() { : ; }
bash$ type myfunc
myfunc is a functionmyfunc (){ :}bash$ alias myalias=:
bash$ type myalias
myalias is aliased to `:'
The type command has a few useful options. If you use the -t option, you can get a single word specifying the command type. This is sometimes useful in scripts:
bash$ type -t echo builtin bash$ type -t grep file
If you use the -a option, you can see ...
Read now
Unlock full access