One may run or “execute” shell scripts by typing it’s filename as a command and pressing <Enter> as they would with a regular command. However, the script file must must have executable permission set (see the previous post). Also, scripts may be given arguments and options similar to other programs.
Scripts stored in a directory on one’s path may be run by simply typing the name of the file and pressing <Enter>. Otherwise one must provide a relative or full path to the location of the script file. Or if one’s current working directory contains the script file it can be run buy adding a “./” to the filename.
Examples…
Run a script named “hello” that is in a directory in your path…
$ hello <Enter>
Run a script named “hello” that is in your current working directory…
$ ./hello <Enter>
Run a script named hello that is in ~/MyScripts/ (a subdirectory of your “home” directory)…
$ ~/MyScripts/hello <Enter>