List of Bash online-tutorials

Here's a list with some (by far not all of course) Bash tutorials found on the Internet.

The primary purpose of that list is to lead beginners to good tutorials and not to the wrong ones. However, the secondary purpose is to provide information to increase quality of the linked tutorials.

My expirience shows that nobody is interested when you “just send a mail to the author”, even if he links a big “contact me” in his article(s). This is another try of influencing the Bash world.

Recommendations

Note that these recommendations are my personal opinion. Please contact me

  • if you have reviews or new sites
  • if you're not okay with a recommendation
  • if you're the author of a mentioned site (remove link, copyright, discussion, …)
  • etc…

The recommendation-indicator “REC” used below is a number between 1 and 10 visualized as a bar:

  • 0% Not recommended to read, at best, don't click the link.
  • 50% Use it with care!
  • 100% The perfect godlike tutorial (I doubt I'll ever find it)
Name (Links to review below)Weblink   REC
indicator
Comments
Bash guide on Greg's wiki click 90%This guide teaches modern stuff and good practises. I recommend to learn from it. It was written by the guys in #bash IRC channel on Freenode (mainly lhunath), because there are so many bad tutorials out there.
Steve Parker's shell scripting guide click90%Very good (not only Bash) shell scripting guide. Teaches good practices, gives background information.
Advanced Bash Scripting Guide (ABS) (review) click 80%Though the ABS doesn't teach the really advanced and safe stuff everywhere, it's one of the most complete and best tutorials I know. You will get a very good start when you learn from it.
IBM developerWorks “Bash by example” click(1)
click(2)
click(3)
80%Doesn't teach outdated stuff, doesn't tell you wrong things. A good start, though not that detailed.
Deadman's click(1)
click(2)
70%Focus isn't scripting per se. Focus is interactive use and increasing the productivity on the prompt. Teaches some nice features.
Bash Shell Programming in Linux (P. Lutus) click70%Good start. Though there are small bugs.
BASH Help at hypexr.org (review) click50%Shows you some nice stuff and links to other ressources. Not a tutorial to learn Bash, though.
Bash Programming Introduction HowTo (TLDP) (review) click 50%A bit outdated, but usable as a start to get into the Bash world.
Quick guide (review) click50%Usable as a start. Doesn't teach wrong stuff, shows you good practices.
linuxconfig.org Bash Scripting Tutorial (review) click 0%Teaches many outdated, unstable, undetailed stuff. You won't learn scripting from there.

Detailed reviews

linuxconfig.org Bash Scripting Tutorial

Article link: http://www.linuxconfig.org/Bash_scripting_Tutorial
Discussion link: http://www.linuxconfig.org/Talk:Bash_scripting_Tutorial (Note: The discussion pagelink now leads to a forum - huh?)

Though the basic idea is nice, using flash terminal sessions and screenshots, there are many bugs or bad constructs.

Some stuff I didn't like there:

  • uses external, unreliable command which instead of builtin type -p to determinate the location of a program
  • uses function SOMENAME keyword instead of the common POSIX-compatible variant SOMENAME() to define a function
  • uses backticks instead of $( … ) for command substitution
  • abuses an additional array to store positional parameters, disregarding that $@ already is array-like
  • uses echo -e and the historical control character \c instead of modern The printf command
  • uses for a in `seq 1 10` instead of a C-like counter loop for ((a=1; a <= 10; a++))
  • the if/else stuff looks as if the test (or [ …]) command is the only thing Bash can execute and check
  • a for loop example that will explode on word-splitting
  • arithmetic tests (the while/until loop examples) using the historical “old way” with test, not modern arithmetic components
  • useless quoting of one-word strings (not that it hurts per se, but it shows that the author has no clue why to use quotes)
  • one chapter is double (copy&paste mistake?) ;-)
  • a weird construct I don't even understand (example for stdout/err redirection): grep -r hda6 * . 1>&2 stderr.txt
  • … some other things that are less important

twkm commented some things on their discussion page, I liked this article there.

Overall, if the author doesn't change the article, it's unusable from my point of view. At least unusable to teach sane Bash scripting.

Quick Guide

Article link: http://www.panix.com/~elflord/unix/bash-tute.html
Discussion Link: not available

This article is usable as basic introduction into the Bash world. It doesn't teach you wrong things, and it uses correct syntax and explanations nearly everywhere. However, it's not usable as complete learning tutorial - but that is not the goal.

One point (I have to critizize something ;-) ):

  • the article says that there are no C-styled for-loops in Bash, this is wrong (maybe the article is for a very old (pre 2.05b) Bash version)

Bash Programming Introduction HowTo

Article link: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-10.html
Discussion link: not available; EMail: mikkey (AT) dynamo.com.ar

A few points:

I like the style this article is written in. If some points are fixed, it could be a really usable starting point for newbies.

BASH Help at hypexr.org

Article link: http://www.hypexr.org/bash_tutorial.php
Discussion link: not available; EMail: scott (AT) hypexr.org

The article is usable to step into the shell world. It's not a tutorial per se, it will tell you some nice CLI-specific things like readline or completion.

Only one point:

  • confusing description of the dotfiles

Advanced Bash Scripting guide (ABS)

Article link: http://tldp.org/LDP/abs/html/
Discussion link: not available; EMail: thegrendel (AT) theriver.com

The only big problem I see with the ABS is, that the name doesn't match the reality. It doesn't teach advanced techniques. That doesn't mean the guide isn't good! It's one of the biggest, most complete and interesting Bash guides I've seen.

I don't want to write every point here that disturbs me. In general it's not that important since the mistakes or wrong assumptions it makes are minimal.

The ABS is definitely worth to read to step deeper into the Bash and commandline world of Linux (since many Linux-specific examples are there, they're unusable for Unices).

Mentionable mistakes:

In Example A-13. ftpget: Downloading files via ftp there's an insane use of the for loop (better: expansion of positional parameters isn't word-aware plus a weird use of shift). The author was informed with the following mail (not from me):

Subject: Error in ABS Guide Contributed Script
From: Michael A. xxxxxxxxxx <EMAIL_PROTECTED>

Dear Mendel Cooper,

I realize you're not the author of the contributed script, but you are the only
one I know who can get it improved, or removed as an example.

I noticed that example A-13 "ftpget" has this structure:

for i in $*   # ==> Parse command line args.
do
	case $i in
	-v) verbflag=-v; echo hash >> ${TMPFILE}; shift;;
	-h) remhost=$2; shift 2;;
	-d) echo cd $2 >> ${TMPFILE};
	    if [ x${verbflag} != x ]; then
	        echo pwd >> ${TMPFILE};
	    fi;
	    shift 2;;
	-c) echo lcd $2 >> ${TMPFILE}; shift 2;;
	-m) echo mget "$2" >> ${TMPFILE}; shift 2;;
	-f) f1=`expr "$2" : "\([^:]*\).*"`; f2=`expr "$2" : "[^:]*:\(.*\)"`;
	    echo get ${f1} ${f2} >> ${TMPFILE}; shift 2;;
	--) shift; break;;
	esac
        # ==> 'lcd' and 'mget' are ftp commands. See "man ftp" . . .
done

The "for NAME [in WORDS ... ;] do COMMANDS; done" syntax does not work with the
builtin command "shift" for managing positional parameters. It was probably the
author's intention to use 'while [ -n "$1" ]', or 'while [[ $1 ]]', or 'while
(( $@ ))' instead of 'for i in $*'.

In any case, the script as written will not work.

Thanks for your attention to this matter,
Mike xxxxxxxxxx,
bash user   ;) 

Unfortunately the author anserwed in short with “why change it, it works” - which I really didn't understand, because he should know better! That's the reason I don't think it's worth to try to improve ABS. The mistakes done there will stay there “because they work”.

scripting/tutoriallist.txt (537 views) · Last modified: 2008/06/25 18:22 by thebonsai
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0