I am new in shells, so I stuck with this kind of question. What is the simplest way to differentiate those commands?
Asked
Active
Viewed 802 times
1 Answers
12
for
t.shthe shell will search thePATHin order for a file namedt.shand execute it if it finds itfor
. t.shthe shell will search thePATHin order for a file namedt.shbut source it if it finds it.In the case of the bash shell, the search behavior for sourced commands has additional considerations, as noted in
man bash:
When bash is not in posix mode, the current directory is searched if no file is found in PATH. If the sourcepath option to the shopt builtin command is turned off, the PATH is not searched.
for
/t.shthe shell will look for filet.shin the filesystem root directory/and attempt to execute itfor
./t.shthe shell will look for filet.shin the shell's current working directory.and attempt to execute it
See also
steeldriver
- 142,475