December 2018
Beginner
452 pages
12h 17m
English
If you were really paying attention, you will have noticed we executed a script that was not executable, using the bash command. Why would we need the shebang, if we specify how to run it anyway? In this case, we would not need the shebang. However, we would need to know exactly which kind of script it is and find the correct binary on the system to run it, which can be kind of a hassle, especially once you have many scripts. Thankfully, there is a better way for us to run these scripts: using the executable permission. Let's see how we can run our hello-world.sh script by setting the executable permission:
reader@ubuntu:~/scripts/chapter_07$ ls -ltotal 4-rw-rw-r-- 1 reader reader 33 Aug 26 12:08 hello-world.shreader@ubuntu:~/scripts/chapter_07$ ...