When I was an university student I had a teacher in the Operating Systems subject that teached me (and a lot of others) to program so bad in shell scripting! I will not name her, but I had to say that today I find the very same errors around the scripts that my colleagues write every day, and this is a kind of watermark of the damage she did.
Luckily I find my way out, studying on other books and practicing on my own (Linux) computer.
So what were the problems?
To understand it must be clear the exercise schema the teacher was adopting, and that was pretty much always the same: a main script (let's call "coordinator" which aim is to parse the argument list and invoke, using recursion, a "worker" script.
Something that can be shown as the following code:
# argument validation...
# export the current directory
# in the path to invoke the worker script
# first call of the worker
# recursion on myself
for f in *
if [ -d $f ]
# do other work...
case $1 in
/*) # absolute
*) # relative
Do you believe the above is easy to read? Is it efficient and does it scale well? Why not using Unix tools and pipes, regular expressions and awk? even better, getopt anyone?
So, dear ex-teacher, what is the whole point in teaching such shit?