You may have noticed that I used ./hello.sh to run the script; you will get an error if you omit the leading ./:
elliot@ubuntu-linux:~$ hello.sh
hello.sh: command not found
The shell can't find the command hello.sh. When you run a command on your terminal, the shell looks for that command in a set of directories that are stored in the PATH variable.
You can use the echo command to view the contents of your PATH variable:
elliot@ubuntu-linux:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
The colon character separates the path of each of the directories. You don't need to include the full path of any command or script (or any executable) that resides in these directories. All the commands you have learned so far reside in /bin and /sbin, which are both stored in your PATH variable. As a result, you can run the pwd command:
elliot@ubuntu-linux:~$ pwd
/home/elliot
There is no need to include its full path:
elliot@ubuntu-linux:~$ /bin/pwd...