Command
- Command is an executable written in any language.
- An executable has execute permissions for owner or group or other(RWX)
- To run the shell script
bash <path-to-script>.sh
# if we change permissions to execute
<path-to-script>.sh
* Now commands like ls, ping etc are executed without complete file path
* When you type any command in linux or windows systems it searches for the executable in certain folders. These folders are listed in environmental variable called PATH
* Linux: folder paths seperated by colon
* Windows: folder paths seperated by semicolon
* Linux Path:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
==>
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/snap/bin
* Now lets make our script2.sh work from anywhere
* copy the script2.sh into any folder which is already part of path variable.
* We can also copy the script to new location and remove the extension
* To see all the environmental variables, possibilities are
* set
* declare
* printenv
* Next Steps:
* Adding folders of our choice to PATH
* Every command generally takes arguments