Join 3,523 readers in helping fund MetaFilter (Hide)

Tags:

What resources do you guys recommend on learning to BASH script, and also learn from other peoples code?
October 11, 2008 9:02 AM   Subscribe

What resources do you guys recommend on learning to BASH script, and also learn from other peoples code?

Hey guys, I am quite interested in learning to Bash script and was wondering what guides you guys thought were the best suited for this task. Also, since learning by example works better for me any resources that taught this way would also be much appreciated.

On the other hand I also realize that learning from actually programming is the much better way, so if there were any sites that like gave you a problem to solve in bash and gave a sample solution to that problem would be the best! Also a nice place to look at others Bash code to learn from it would also be much appreciated.
posted by Javed_Ahamed to Computers & Internet (11 answers total) 15 users marked this as a favorite
 
I think this is one of the guides I used. There's also the Bash Reference Manual.
posted by jjb at 9:20 AM on October 11, 2008


Is there some specific reason why bash? Perl or Python are much more powerful, non-crazy, expressive languages and have a superset of bash's abilities to deal with the shell environment.
posted by dmd at 9:51 AM on October 11, 2008


jjb's stuff is good. I also found this to be a nice guide.

Also a nice place to look at others Bash code to learn from it would also be much appreciated.

There ought to be plenty of shell scripts kicking around on your Linux install.

I take it you're OK with all the other Unixy stuff - permissions, what hard links are, how to get into the man pages, what xargs does, how to use vi. Gotta learn those as well.
posted by I_pity_the_fool at 9:56 AM on October 11, 2008


Perl or Python are much more powerful, non-crazy, expressive languages and have a superset of bash's abilities to deal with the shell environment.

While this is correct, as a veteran Python and Perl programmer I have to say that there are times when bash scripting is a better choice. If your program is primarily going to call other programs and doesn't have much logic to it, then I think it makes more sense to do it in shell script. It looks really strange to me when I see a Python or Perl script which is just a series of calls to os.system() or system().

Use the best tool for the job.

That said, if you want to do anything interesting, Bash is probably not the right tool. I wouldn't spend time learning the whole language. It'll warp your mind worse than Perl. You won't need many of the features, and if you think you do, you should start thinking about whether another tool will be better.
posted by grouse at 11:39 AM on October 11, 2008


Advanced Bash Scripting Guide

Bash Pitfalls
posted by dws at 11:55 AM on October 11, 2008


Greg's BashFAQ is my favorite. The LDP one is a little outdated and frumpy.
posted by rhizome at 11:57 AM on October 11, 2008


The man pages are actually quite good. You need to read the man pages for all the other common shell utilities, too, though.
posted by hattifattener at 12:04 PM on October 11, 2008


thanks for the help so far guys. Yeah i was planning on learning bash and python to help with my scripting needs and decided to start with bash. I mean it seems its just used to help automate things in linux, i think the only bash script I am really using right now is one that cleans out apt get and dloads a new wallpaper every hour or so. Any useful script repository would be nice as well so i could learn from others code.
posted by Javed_Ahamed at 2:08 PM on October 11, 2008


there are lots of sample scripts in the aforementioned Absolute Bash Scripting Guide.

There's some pretty neat scripts here that you can reference.
posted by namewithoutwords at 4:16 PM on October 11, 2008


It's the Advanced Bash Scripting Guide and, yeah, I can't recommend that one enough.
posted by word_virus at 8:21 PM on October 11, 2008


You might find this helpful as well.
posted by I_pity_the_fool at 2:02 PM on November 1, 2008


« Older Need help locating a traumatiz...   |  Which drive imaging utility cr... Newer »
This thread is closed to new comments.