I have the following script:
$ cat test.sh
#! /usr/local/bin/bash
date
Run it,
$ test.sh
-bash: test.sh: command not found
It works
$ ./test.sh
Thu Oct 25 18:04:45 CST 2018
Nonetheless, I am aware that test.sh
is identical to ./test.sh
,
$ file test.sh
test.sh: Bourne-Again shell script text executable, ASCII text
$ file ./test.sh
./test.sh: Bourne-Again shell script text executable, ASCII text
What' the subtle difference between test.sh
and ./test.sh
?
./
and from any location if you add directory where the script is stored to$PATH
variable. The same is for Windows, it's not Linux/UNIX specific