Log In
Or create an account -> 
Imperial Library
  • Home
  • About
  • News
  • Upload
  • Forum
  • Help
  • Login/SignUp

Index
Title Page Copyright and Credits
Learn Linux Shell Scripting – Fundamentals of Bash 4.4
About Packt
Why subscribe? PacktPub.com
Contributors
About the author About the reviewer Packt is searching for authors like you
Preface
Who this book is for What this book covers To get the most out of this book
Download the example code files Download the color images Conventions used
Get in touch
Reviews
Disclaimer
Introduction
What is Linux? What is Bash? Summary
Setting Up Your Local Environment
Technical requirements Choosing between a virtual machine and a physical installation Setting up VirtualBox Creating an Ubuntu virtual machine
Creating the virtual machine in VirtualBox Installing Ubuntu on the virtual machine Accessing the virtual machine via SSH
Summary Questions Further reading
Choosing the Right Tools
Technical requirements Using graphical editors for shell scripting
Atom
Atom installation and configuration
Notepad++
Using command-line editors
Vim
Vim summary .vimrc Vim cheat sheet
nano
Combining graphical editors with command-line editors when writing shell scripts Summary Questions Further reading
The Linux Filesystem
Technical requirements The Linux filesystem explained
What is a filesystem? What makes the Linux filesystem unique?
Structure of the Linux filesystem
Tree structure Overview of top-level directories
What about multiple partitions? /bin/, /sbin/, and /usr/ /etc/ /opt/, /tmp/, and /var/
Everything is a file
Different types of files
Summary Questions Further reading
Understanding the Linux Permissions Scheme
Technical requirements Read, write, and execute
RWX
Users, groups, and others Manipulating file permissions and ownership
chmod, umask sudo, chown, and chgrp
sudo chown, chgrp
Working with multiple users Advanced permissions
File attributes Special file permissions Access Control Lists (ACLs)
Summary Questions Further reading
File Manipulation
Technical requirements Common file operations
Copying Removing Renaming, moving, and linking
Archiving Finding files
locate find
Summary Questions Further reading
Hello World!
Technical requirements First steps
The shebang Running scripts
Readability
Comments
Script header
Verbosity
Verbosity in comments Verbosity of commands Verbosity of command output
Keep It Simple, Stupid (KISS) Summary Questions Further reading
Variables and User Input
Technical requirements What is a variable?
Why do we need variables? Variables or constants?
Variable naming Dealing with user input
Basic input Parameters and arguments
Interactive versus non-interactive scripts
Combining positional arguments and read
Summary Questions Further reading
Error Checking and Handling
Technical requirements Error checking
Exit status Functional checks Test shorthand
Variable refresher Bash debugging
Error handling
if-then-exit if-then-else Shorthand syntax
Error prevention
Checking arguments Managing absolute and relative paths Dealing with y/n
Summary Questions Further reading
Regular Expressions
Technical requirements Introducing regular expressions
What is a regular expression?
grep Greediness Character matching Line anchors Character classes
Globbing
What is globbing? Similarities with regular expressions More globbing Advanced globbing Disabling globbing, and other options
Using regular expressions with egrep and sed
Advanced grep Introducing egrep sed, the stream editor
Stream editing In-place editing Line manipulation
Final remarks Summary Questions Further reading
Conditional Testing and Scripting Loops
Technical requirements Advanced if-then-else
A recap on if-then-else  Using regular expressions in tests The elif condition Nesting Getting help
The while loop
The until loop Creating an interactive while loop
The for loop
Globbing and the for loop
Loop control
Breaking the loop The continue keyword Loop control and nesting
Summary Questions Further reading
Using Pipes and Redirection in Scripts
Technical requirements Input/output redirection
File descriptors Redirecting output
stdout stderr Redirect all output Special output redirection
/dev/null /dev/zero
Input redirection
Generating a password
Advanced redirecting
Redirecting redirections Command substitution Process substitution
Pipes
Binding stdout to stdin Practical examples
Yet another password generator Setting passwords in a script tee
Here documents
Heredocs and variables Using heredocs for script input Here strings
Summary Questions Further reading
Functions
Technical requirements Functions explained
Hello world! More complexity Variable scopes Practical examples
Error handling
Augmenting functions with parameters
Colorful Returning values
Function libraries
Source More practical examples
Current working directory Type checking Yes-no check
Summary Questions Further reading
Scheduling and Logging
Technical requirements Scheduling with at and cron
at
Time syntax The at queue at output
cron
crontab
Syntax for the crontab
Logging script results
Crontab environment variables
PATH SHELL MAILTO
Logging with redirection Final logging considerations
A note on verbosity
Summary Questions Further reading
Parsing Bash Script Arguments with getopts
Technical requirements Positional parameters versus flags
Using flags on the command line
The getopts shell builtin
The getopts syntax Multiple flags Flags with arguments Combining flags with positional arguments
Summary Questions Further reading
Bash Parameter Substitution and Expansion
Technical requirements Parameter expansion
Parameter substitutions – recap Default values
Input checking
Parameter length
Variable manipulation
Pattern substitution Pattern removal Case modification Substring expansion
Summary Questions Further reading
Tips and Tricks with Cheat Sheet
Technical requirements General tips and tricks
Arrays The history command Creating your own aliases
Command-line shortcuts
Fun with exclamation marks
Running commands from the history
Keyboard shortcuts
Copying and pasting from the terminal Reverse search
Cheat sheet for interactive commands
Navigation
cd ls pwd
File manipulation
cat less touch mkdir cp rm mv ln head tail
Permissions and ownership
chmod umask chown chgrp sudo su useradd groupadd usermod
Summary Final words
Assessments
Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16
Other Books You May Enjoy
Leave a review - let other readers know what you think
  • ← Prev
  • Back
  • Next →
  • ← Prev
  • Back
  • Next →

Chief Librarian: Las Zenow <zenow@riseup.net>
Fork the source code from gitlab
.

This is a mirror of the Tor onion service:
http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion