Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn Linux Shell Scripting – Fundamentals of Bash 4.4

You're reading from   Learn Linux Shell Scripting – Fundamentals of Bash 4.4 A comprehensive guide to automating administrative tasks with the Bash shell

Arrow left icon
Product type Paperback
Published in Dec 2018
Publisher Packt
ISBN-13 9781788995597
Length 452 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Sebastiaan Tammer Sebastiaan Tammer
Author Profile Icon Sebastiaan Tammer
Sebastiaan Tammer
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Introduction FREE CHAPTER 2. Setting Up Your Local Environment 3. Choosing the Right Tools 4. The Linux Filesystem 5. Understanding the Linux Permissions Scheme 6. File Manipulation 7. Hello World! 8. Variables and User Input 9. Error Checking and Handling 10. Regular Expressions 11. Conditional Testing and Scripting Loops 12. Using Pipes and Redirection in Scripts 13. Functions 14. Scheduling and Logging 15. Parsing Bash Script Arguments with getopts 16. Bash Parameter Substitution and Expansion 17. Tips and Tricks with Cheat Sheet 18. Assessments 19. Other Books You May Enjoy

Chapter 7

  1. What do we, by convention, do as the first thing when we learn a new programming or scriping language?
    We print the string "Hello World".
  2. What is the shebang for Bash?
    #!/bin/bash
  3. Why is the shebang needed?
    If we're running the script without specifying which program we should use, the shebang will allow Linux to use the correct one.
  4. In what three ways can we run a script?
    • By using the program which we want to run it with: bash script.sh
    • By setting the executable permission and prefixing the scriptname with ./: ./script.sh

 

    • By setting the executable permission and using the fully qualified path to the file: /tmp/script.sh
  1. Why do we place such emphasis on readability when creating shell scripts?
    • Scripts are much easier to use if the person using them can easily understand what the script does
    • If anyone other than yourself needs to edit...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime