Skip to Content
Learn Linux Shell Scripting - Fundamentals of Bash 4.4
book

Learn Linux Shell Scripting - Fundamentals of Bash 4.4

by Sebastiaan Tammer
December 2018
Beginner
452 pages
12h 17m
English
Packt Publishing
Content preview from Learn Linux Shell Scripting - Fundamentals of Bash 4.4

Running scripts

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$ ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Bash Scripting Fundamentals

Bash Scripting Fundamentals

Sander van Vugt

Publisher Resources

ISBN: 9781788995597Supplemental Content