Book description
Break through the practice of writing tedious code with shell scripts
About This Book- Learn to impeccably build shell scripts and develop advanced applications
- Create smart solutions by writing and debugging scripts
- A step-by-step tutorial to automate routine tasks by developing scripts
Learning Linux Shell Scripting is ideal for those who are proficient at working with Linux and want to learn about shell scripting to improve their efficiency and practical skills.
What You Will Learn- Familiarize yourself with the various text filtering tools available in Linux
- Understand expressions and variables and how to use them practically
- Automate decision-making and save a lot of time and effort of revisiting code
- Get to grips with advanced functionality such as using traps, dialogs to develop screens & Database administration such as MySQL or Oracle
- Start up a system and customize a Linux system
- Taking backup of local or remote data or important files.
- Use existing other language scripts such as Python, Perl & Ruby in Shell Scripts
Linux is the most powerful and universally adopted OS. Shell is a program that gives the user direct interaction with the operating system. Scripts are collections of commands that are stored in a file. The shell reads this file and acts on commands as if they were typed on the keyboard.
Learning Linux Shell Scripting covers Bash, GNU Bourne Again Shell, preparing you to work in the exciting world of Linux shell scripting. CentOS is a popular rpm-based stable and secured Linux distribution. Therefore, we have used CentOS distribution instead of Ubuntu distribution. Linux Shell Scripting is independent of Linux distributions, but we have covered both types of distros. We start with an introduction to the Shell environment and basic commands used. Next, we explore process management in Linux OS, real-world essentials such as debugging and perform Shell arithmetic fluently. You'll then take a step ahead and learn new and advanced topics in Shell scripting, such as decision making, starting up a system, and customizing a Linux environment. You will also learn about grep, stream editor, and AWK, which are very powerful text filters and editors. Finally, you'll get to grips with taking backup, using other language scripts in Shell Scripts as well as automating database administration tasks for MySQL and Oracle.
By the end of this book, you will be able to confidently use your own shell scripts in the real world.
Style and approachThis practical book will go from the very basics of shell scripting to complex, customized automation. The idea behind this book is to be as practical as possible and give you the look and feel of what real-world scripting is like.
Publisher resources
Table of contents
- Title Page
- Copyright and Credits
- Dedication
- Packt Upsell
- Contributors
- Preface
-
Getting Started and Working with Shell Scripting
- Comparison of shells
- Tasks done by the shell
- Working in the shell
- Learning basic Linux commands
- Our first script – Hello World
- Compiler and interpreter – differences in process
- When not to use scripts
- Various directories
- Working more effectively with Shell – basic commands
- Working with permissions
- Summary
- Drilling Deep into Process Management, Job Control, and Automation
- Using Text Processing and Filters in Your Scripts
- Working with Commands
- Exploring Expressions and Variables
-
Neat Tricks with Shell Scripting
- Interactive shell scripts – reading user input
- The here document and the << operator
- The here string and the <<< operator
- File handling
- Debugging
- Summary
- Performing Arithmetic Operations in Shell Scripts
- Automating Decision-Making in Scripts
- Automating Repetitive Tasks
- Working with Functions
- Using Advanced Functionality in Scripts
- System Startup and Customizing a Linux System
-
Pattern Matching and Regular Expressions with sed and awk
- The basics of regular expressions
-
sed – non-interactive stream editor
- Understanding sed
- Understanding regular expression usage in sed
- Addressing in sed
- How to modify a file with sed
- Printing – the p command
- Deleting – the d command
- Substitution – the s command
- Range of selected lines the comma
- Multiple edits – the e command
- Reading from files – the r command
- Writing to files – the w command
- Appending – the a command
- Inserting – the i command
- Changing – the c command
- Transform – the y command
- Quit – the q command
- Holding and getting – the h and g commands
- Holding and exchanging – the h and x commands
- sed scripting
-
Using awk
- The meaning of awk
- Using awk
- Input from commands
- How awk works
- awk commands from within a file
- Records and fields
- Patterns and actions
- Regular expressions
- Writing the awk script file
- Using variables in awk
- Decision-making using an if statement
- Using the for loop
- Using the while loop
- Using the do while loop
- Summary
-
Taking Backup and Embedding Other Languages in Shell Scripts
- Backup of files from command line
-
Embedding other language codes or scripts in Bash shell scripts
- Embedding other language code in Bash shell script
- Sending output to Bash Script
- Storing other language output to Bash variable
- Sending data to an embedded language code
- Using data from file by embedded language
- Sending user input to the embedded code
- Embedding Python code in Bash shell Script
- Embedding Ruby code
- Embedding other language code in Bash – comparative study
- A summary of commands for embedding other programming languages
- Summary
- Database Administration Using Shell Scripts
- Other Books You May Enjoy
Product information
- Title: Learning Linux Shell Scripting - Second Edition
- Author(s):
- Release date: May 2018
- Publisher(s): Packt Publishing
- ISBN: 9781788993197
You might also like
book
Modern C
Modern C introduces you to modern day C programming, emphasizing the unique and new features of …
book
Python One-Liners
Python One-Liners will teach you how to read and write “one-liners”: concise statements of useful functionality …
book
The Time Cleanse: A Proven System to Eliminate Wasted Time, Realize Your Full Potential, and Reinvest in What Matters Most
Publisher's Note: Products purchased from Third Party sellers are not guaranteed by the publisher for quality, …
book
Networking Fundamentals
Become well-versed with basic networking concepts such as routing, switching, and subnetting, and prepare for the …