Linux Shell Scripting with Bash: A Comprehensive Guide and Reference for Linux Users and Administrators


According to IDC, over 170,000 new servers were shipped in the first quarter of 2003. That also means that there were potentially more than 170,000 people like you charged with administering these systems without the proper knowledge or training to do so. Linux Shell Scripting with Bash will help you learn to not only get your system up and running quickly by employing the Bash shell, but it will also show you professional scripting solutions through the use of structured programming and standard Linux ...

See more details below
$35.48 price
(Save 29%)$49.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (14) from $4.52   
  • New (8) from $26.88   
  • Used (6) from $4.52   
Sending request ...


According to IDC, over 170,000 new servers were shipped in the first quarter of 2003. That also means that there were potentially more than 170,000 people like you charged with administering these systems without the proper knowledge or training to do so. Linux Shell Scripting with Bash will help you learn to not only get your system up and running quickly by employing the Bash shell, but it will also show you professional scripting solutions through the use of structured programming and standard Linux development tools. The book focuses on the Linux environment, which the shell relies on to function, and the robust Linux tool set, making this book ideal for learning shell scripting. Real-world scripts are included that are readable, extendable and easy to debug. This book is an asset to any Linux user.

Read More Show Less

Product Details

  • ISBN-13: 9780672326424
  • Publisher: Sams
  • Publication date: 1/29/2004
  • Series: Developer's Library Series
  • Pages: 412
  • Sales rank: 783,872
  • Product dimensions: 6.45 (w) x 8.97 (h) x 0.94 (d)

Meet the Author

Ken Burtch graduated with a Computer Science first class honors degree from Brock University in St. Catharines, Canada and did his Masters work at Queen's University in Kingston, Canada. He has been using Linux since version 0.97, at a time before Linux was popular. He is the founder of PegaSoft Canada (, an association that promotes Linux advocacy, education, and development in southern Ontario. He has worked with a number of companies, including Mackenzie Financial Corporation, one of Canada's largest mutual fund companies. Ken is an active member of the Writers' Circle of Durham Region and his award-winning short story, "Distance," was recently published in the Signatures anthology.

Read More Show Less

Table of Contents

1. The Linux Environment.

The Origin of Linux. Files and File Systems. Directories. Inodes and Links. Pipe and Socket Files. Device Files.

2. Operating the Shell.

Bash Keywords. Command Basics. Command-Line Editing. Variable Assignments and Displaying Messages. Multiple Commands. Command History. Directory Commands. Specialized Navigation and History. The Colon Command. Reference Section.

3. Files, Users, and Shell Customization.

Listing Files. printf Command. Getting Help. Fixing the Display. Working with Files. Working with People. Shell Aliases. The Bash Hash Table. Customizing Your Prompt. Long Command Lines. Customizing Command-Line Editing. Your Session Profile. Reference Section.

4. Script Basics.

Creating a Script. Creating a Well-Behaved Script. The Header. Global Declarations. Sanity Checks. The Main Script. Cleanup. Stopping a Script. Reading Keyboard Input. Basic Redirection. Standard Output, Error, and Input. Built-In Versus Linux Commands. The Set and Shopt Commands. Reference Section.

5. Variables.

Variable Basics. Predefined Variables. The Effect of Quotations. Variable Attributes. Arrays. Exporting Variables and the Linux Environment. The eval Command. story.bash: A Story Generator. Reference Section.

6. Expressions.

Expansions. The Basic if Command. File Expressions. Multiple Tests. Strings. Arithmetic Expressions. Logical Expressions. Relational Operations. Bitwise Operations. Self-Referential Operations. Other let Features. temperature.bash: Converting Fahrenheit to Celsius. Arithmetic Tests. Pattern Recognition. Globbing Options. Filename Brace Expansion ( {..} ). Dollar Sign Substitutions. Arithmetic Expression Substitution ( ((..)) ). mixer.bash: HTML Color Mixer. Reference Section.

7. Compound Commands.

Command Status Codes. if Command. case Command. while Loop. until Loop. for Loops. Embedded let ( ((..)) ). Grouping Commands ( {..} ). report.bash: Report Formatter.

8. Debugging and Version Control.

Shell Debugging Features. Debug Traps. Version Control (CVS). Creating Transcripts. Watching Running Scripts. Timing Execution with Time. Creating Man Pages. Source Code Patches. Shell Archives. Reference Section.

9. Parameters and Subshells.

Positional Parameters. The getopts Command. The getopt Command. Subshells. Reference Section.

10. Job Control and Signals.

Job Control. Signals. The suspend Command. Traps. Exit Handlers. The killall Command. Being Nice. Process Status. Reference Section.

11. Text File Basics.

Working with Pathnames. File Truncation. Identifying Files. Creating and Deleting Files. Moving and Copying Files. More Information about Files. Transferring Files between Accounts (wget). Transferring Files with FTP. Transferring Files with Secure FTP (sftp). Verifying Files. Splitting Large Files. Tabs and Spaces. Temporary Files. Lock Files. Named Pipes. Process Substitution. Opening Files. Using head and tail. File Statistics. Cutting. Pasting. Columns. Folding. Joining. Merging. Reference Section.

12. Text File Processing.

Finding Lines. Locating Files. Finding Files. Sorting. Character Editing (tr). File Editing (sed). Compressing Files. Reference Section.

13. Console Scripting.

The Linux Console. The Console Keyboard. The Console Display. tput. select Menus. Custom Menus. Reference Section.

14. Functions and Script Execution.

Running Scripts. The Linux Execution Environment. The Source Command (.). Switching Scripts with exec. Writing Recurring Scripts. Writing Continually Executing Scripts. Shell Functions. Local Variables. Recursion and Nested Functions. Function Attributes. Reference Section.

15. Shell Security.

The Basic Linux Security Model. Knowing Who You Are (id). Transferring Ownership (chown/chgrp). Changing Access Rights (chmod). Default Access Rights (umask). setuid/setgid and Scripts. The chroot Command. Resource Limits (ulimit). Restricted Shells. Secure File Deletion (wipe). Reference Section.

16. Network Programming.

Sockets. Client-Server and Peer-to-Peer. Network Clients. CGI Scripting. CGI Environment Variables. Processing Forms. Basic Web Page Stripping (lynx). Reference Section.

17. Data Structures and Databases.

Associative Arrays Using Bash Arrays. Hash Tables Using Bash Arrays. Binary Trees Using Bash Arrays. Working with PostgreSQL Databases (psql). Working with MySQL Databases. Reference Section.

18. Final Topics.

The echo Command. More Uses for set. Date Conversions. Completions. Locales. The du Command. Memory Usage. noclobber and Forced Overwriting. The fc Command. ! Word Designators and Modifiers. Running Scripts from C. Journey's End. Reference Section.

Appendix A. A Complete Example.

Appendix B. Summary of Bash Built-In Commands.

Appendix C. Bash Options.

Appendix D. Error Codes.

Appendix E. Signals.

Appendix F. ASCII Table.



Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted October 31, 2004


    Amongst recent computer books, this is a rarity. There seems to be only 1 diagram in the entire book. No GUIs to pretty up the scene. In this sense, the book is a throwback to those texts of the 80s. Strictly command line and file I/O. Bash under linux is shown by the book to be not that different from an earlier Bourne shell. Or even the more rudimentary C shell. The various chapters discuss such items as defining variables and thence using these to build up expressions in a script. Burtch methodically shows how to increase the complexity of your scripting. If some of you come from an earlier unix background, and have scripted there, then the book is reassuring. It should validate that most of your expertise carries over into bash and linux. Sure, there might be some new material. But the book shows that a typical script is not that different from a unix script of 20 years ago.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)