Book description
Pro Bash Programming teaches you how to effectively utilize the Bash shell in your programming. The Bash shell is a complete programming language, not merely a glue to combine external Linux commands. By taking full advantage of Shell internals, Shell programs can perform as snappily as utilities written in C or other compiled languages. And you will see how, without assuming Unix lore, you can write professional Bash 4.3 programs through standard programming techniques.
This second edition has updated for Bash 4.3, and many scripts have been rewritten to make them more idiomatically Bash, taking better advantage of features specific to Bash. It is easy to read, understand, and will teach you how to get to grips with Bash programming without drowning you in pages and pages of syntax.
Using this book you will be able to use the shell efficiently, make scripts run faster using expansion and external commands, and understand how to overcome many common mistakes that cause scripts to fail. This book is perfect for all beginning Linux and Unix system administrators who want to be in full control of their systems, and really get to grips with Bash programming.
Table of contents
- Cover
- Title
- Copyright
- Dedication
- Contents at a Glance
- Contents
- About the Authors
- Acknowledgments
- Chapter 1: Hello, World: Your First Shell Program
- Chapter 2: Input, Output, and Throughput
- Chapter 3: Looping and Branching
- Chapter 4: Command-Line Parsing and Expansion
- Chapter 5: Parameters and Variables
- Chapter 6: Shell Functions
- Chapter 7: String Manipulation
- Chapter 8: File Operations and Commands
-
Chapter 9: Reserved Words and Built-In Commands
- help, Display Information About Built-In Commands
- time, Print Time Taken for Execution of a Command
-
read, Read a Line from an Input Stream
- -r, Read Backslashes Literally
- -e, Get Input with the readline Library
- -a, Read Words into an Array
- -d DELIM, Read Until DELIM Instead of a Newline
- -n NUM, Read a Maximum of NUM Characters
- -s, Do Not Echo Input Coming from a Terminal
- -p PROMPT:, Output PROMPT Without a Trailing Newline
- -t TIMEOUT, Only Wait TIMEOUT Seconds for Complete Input
- -u FD: Read from File Descriptor FD Instead of the Standard Input
- -i TEXT, Use TEXT as the Initial Text for Readline
- eval, Expand Arguments and Execute Resulting Command
- Poor Man’s Arrays
- Setting Multiple Variables from One Command
- type, Display Information About Commands
- builtin, Execute a Built-In Command
- command, Execute a Command or Display Information About Commands
- pwd, Print the Current Working Directory
- Deprecated Built-Ins
- Dynamically Loadable Built-Ins
- Summary
- Exercise
- Chapter 10: Writing Bug-Free Scripts and Debugging the Rest
- Chapter 11: Programming for the Command Line
- Chapter 12: Runtime Configuration
- Chapter 13: Data Processing
- Chapter 14: Scripting the Screen
- Chapter 15: Entry-Level Programming
-
Appendix A: Shell Variables
- BASH
- BASHPID
- BASH_ALIASES
- BASH_ARGC
- BASH_ARGV
- BASH_CMDS
- BASH_COMMAND
- BASH_EXECUTION_STRING
- BASH_LINENO
- BASH_REMATCH
- BASH_SOURCE
- BASH_SUBSHELL
- BASH_VERSINFO
- BASH_VERSION
- COMP_CWORD
- COMP_KEY
- COMP_LINE
- COMP_POINT
- COMP_TYPE
- COMP_WORDBREAKS
- COMP_WORDS
- DIRSTACK
- EUID
- FUNCNAME
- GROUPS
- HISTCMD
- HOSTNAME
- HOSTTYPE
- LINENO
- MACHTYPE
- OLDPWD
- OPTARG
- OPTIND
- OSTYPE
- PIPESTATUS
- PPID
- PWD
- RANDOM
- REPLY
- SECONDS
- SHELLOPTS
- SHLVL
- UID
- BASH_ENV
- CDPATH
- COLUMNS
- COMPREPLY
- EMACS
- FCEDIT
- FIGNORE
- GLOBIGNORE
- HISTCONTROL
- HISTFILE
- HISTFILESIZE
- HISTIGNORE
- HISTSIZE
- HISTTIMEFORMAT
- HOME
- HOSTFILE
- IFS
- IGNOREEOF
- INPUTRC
- LANG
- LC_ALL
- LC_COLLATE
- LC_CTYPE
- LC_MESSAGES
- LC_NUMERIC
- LINES
- MAILCHECK
- MAILPATH
- OPTERR
- PATH
- POSIXLY_CORRECT
- PROMPT_COMMAND
- PROMPT_DIRTRIM
- PS1
- PS2
- PS3
- PS4
- SHELL
- TIMEFORMAT
- TMOUT
- TMPDIR
- auto_resume
- histchars
- Index
Product information
- Title: Pro Bash Programming : Scripting the GNU/Linux Shell, Second Edition
- Author(s):
- Release date: June 2015
- Publisher(s): Apress
- ISBN: 9781484201213
You might also like
book
Pro Bash Programming: Scripting the GNU/Linux Shell
The bash shell is a complete programming language, not merely a glue to combine external Linux …
book
Shell Scripting: Expert Recipes for Linux, Bash, and More
A compendium of shell scripting recipes that can immediately be used, adjusted, and applied The shell …
book
Linux Command Line and Shell Scripting Techniques
Practical and actionable recipes for using shell and command-line scripting on your Linux OS with confidence …
book
Linux Shell Scripting Cookbook - Third Edition
Do amazing things with the shell About This Book Become an expert in creating powerful shell …