Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Cover Page
Title Page
Copyright
Contents at a Glance
Contents
About the Author
About the Technical Reviewer
Introduction
Why the Shell?
Just the Shell, Ma'am, Just the Shell
A Brief History of sh
Which Version of Bash?
Who Will Benefit from This Book?
What's in the Book?
Downloading the Code
Contacting the Author
CHAPTER 1 Hello, World! Your First Shell Program
The Code
The File
Choosing and Using a Text Editor
Building a Better "Hello, World!"
Summary
Exercises
CHAPTER 2 Input, Output, and Throughput
Parameter and Variables
Arguments and Options
echo, and Why You Should Avoid It
printf: Formatting and Printing Data
Line Continuation
Standard Input/Output Streams and Redirection
Reading Input
Pipelines
Command Substitution
Exercises
CHAPTER 3 Looping and Branching
Exit Status
Testing an Expression
Lists
Conditional execution
Looping
while
Summary
Exercises
CHAPTER 4 Command-Line Parsing and Expansion
Quoting
Brace Expansion
Tilde Expansion
Parameter and Variable Expansion
Arithmetic Expansion
Command Substitution
Word Splitting
Pathname Expansion
Process Substitution
Parsing Options
Summary
Commands
Exercises
CHAPTER 5 Parameters and Variables
The Scope of a Variable: Can You See It from Here?
Shell Variables
The Naming of Variables
Parameter Expansion
Positional Parameters
Arrays
Summary
Exercises
CHAPTER 6 Shell Functions
Definition Syntax
Compound Commands
Getting Results
Function Libraries
Sample Script
Summary
Exercises
CHAPTER 7 String Manipulation
Concatenation
Processing Character by Character
Case Conversion
Comparing Contents Without Regard to Case
Check for Valid Variable Name
Insert One String into Another
Overlay
Trim Unwanted Characters
Index
Summary
Exercises
CHAPTER 8 File Operations and Commands
Reading a File
External Commands
Regular Expressions
File Name Expansion Options
Summary
Shell Options
External Commands
Exercises
CHAPTER 9 Reserved Words and Builtin Commands
help, Display Information About Builtin Commands
time, Print Time Taken for Execution of a Command
read, Read a Line from an Input Stream
Setting Multiple Variables from One Command
type, Display Information About Commands
builtin, Execute a Builtin Command
command, Execute a Command or Display Information About Commands
pwd, Print the Current Working Directory
Deprecated Builtins
Dynamically Loadable Builtins
Summary
Commands and Reserved Words
Exercises
CHAPTER 10 Writing Bug-Free Scripts and Debugging the Rest
Prevention Is Better Than Cure
Debugging a Script
Summary
Exercises
CHAPTER 11 Programming for the Command Line
Manipulating the Directory Stack
Filesystem Functions
Miscellaneous Functions
Managing Man Pages
Games
Summary
Exercises
CHAPTER 12 Runtime Configuration
Defining Variables
Command-Line Options and Arguments
Menus
Q&A Dialogue
Configuration Files
Scripts with Several Names
Environment Variables
All Together Now
Summary
Exercises
CHAPTER 13 Data Processing
Arrays
Data File Formats
Summary
Exercises
CHAPTER 14 Scripting the Screen
Teletypewriter vs. Canvas
Stretching the Canvas
Priming the Canvas
Moving the Cursor
Changing Rendition Modes and Colors
Placing a Block of Text on the Screen
Scrolling Text
Rolling Dice
Summary
Exercises
CHAPTER 15 Entry-Level Programming
Single-Key Entry
History in Scripts
Sanity Checking
Form Entry
Reading the Mouse
Summary
Exercises
APPENDIX 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
MAIL
MAILCHECK
MAILPATH
OPTERR
PATH
POSIXLY_CORRECT
PROMPT_COMMAND
PROMPT_DIRTRIM
PS1
PS2
PS3
PS4
SHELL
TIMEFORMAT
TMOUT
TMPDIR
auto_resume
histchars
Index
← Prev
Back
Next →
← Prev
Back
Next →