更新时间:2021-07-09 19:48:21
coverpage
Title Page
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
Shell Something Out
Introduction
Displaying output in a terminal
How to do it...
How it works...
There's more...
Escaping newline in echo
Printing a colored output
Using variables and environment variables
Finding the length of a string
Identifying the current shell
Checking for super user
Modifying the Bash prompt string (username@hostname:~$)
Function to prepend to environment variables
Math with the shell
Playing with file descriptors and redirection
Redirection from a file to a command
Redirecting from a text block enclosed within a script
Custom file descriptors
Arrays and associative arrays
Defining associative arrays
Listing of array indexes
Visiting aliases
Escaping aliases
Listing aliases
Grabbing information about the terminal
Getting and setting dates and delays
Producing delays in a script
Debugging the script
Shebang hack
Functions and arguments
The recursive function
Reading the return value (status) of a command
Passing arguments to commands
Sending output from one command to another
Spawning a separate process with subshell
Subshell quoting to preserve spacing and the newline character
Reading n characters without pressing the return key
Running a command until it succeeds
A faster approach
Adding a delay