Hi, can anyone suggest me a book about linux shell programming?
Dazza
Hi, can anyone suggest me a book about linux shell programming?
Dazza
For Linux you usually mean Bash.
The Advanced Bash Guide is really good: Link
How about A Practical Guide to Linux(R) Commands, Editors, and Shell Programming or Classic Shell Scripting.
This posting has quite a lot of links to Unix and Linux resources - in particular, the books by Mark Sobell go into shell programming in some depth.
pick Mastering Unix Shell Scripting if you need something more advanced, or if you prefer Korn shell (ksh93)
I'd just `man bash'. Here are a couple of cheat sheets you may like too:
--
http://www.linux-sxs.org/programming/bashcheat.html
http://www.patchshorts.com/cheatsheets/bash
http://www.sshhelp.com/bash-cheat-sheet/
http://cheat.errtheblog.com/s/bash/
http://www.shell-tips.com/sheets/bash-help-sheet.pdf
http://guegue.net/BashProgramming
http://rydow.wordpress.com/2007/06/19/cheat-sheet-for-emacs/
http://www.docstoc.com/docs/289890/Bash-VI-Editing-Mode-(readline)-Cheat-Sheet
Learning the bash Shell: Unix Shell Programming is a fairly decent read
so is Linux Shell Scripting with Bash (Developer's library)
--
Contrary to popular belief, bash isn't the only scripting language
native to the UNIX family of systems :)
Bash (as programming language) is a specific one.
For example, did you ever wonder why there is no lint for bash code? :)
When learning bash, an important goal is to learn how to avoid pitfalls.
Bash Pitfalls will give you an idea about what I mean.
Bash is a good shell to learn. Several good references have been given. Bash is the default shell on linux, and is widely available on Unix...but it is not universal.
When learning shell programming, posix-sh remains the most portable variant to learn. In general, posix-sh scripts will run in bourne shell, bash, and ksh without modification. Because of that, posix-sh is (or perhaps "should be") preferred for doing any kind of system administration scripting.
I happen to like a few more creature comforts in my interactive shell, so I use the Korn Shell. Korn shell is almost the same as a posix-shell, so I can write shell scripts without having to translate syntax from my interactive shell to the script. The Korn Shell is the book I used to learn ksh, and continue to use for reference when the need arises.
I second the recommendation for Essential System Administration. This book contains a lot of examples of good shell scripts to accomplish common system administration tasks. The examples show some differences between the major flavors of Unix, but tend to stick to portable posix shell code.