[olug] Newbie Bash Scripting Tutorial

Aric Aasgaard aric at omahax.com
Thu Sep 17 12:48:46 UTC 2009


Learning bash to me is more about learning the standard *nix aps 
awk, grep and sed are good ones to start with.

I use sed in most of my bash scripts.

These are awesome instructions 
http://www.grymoire.com/Unix/Sed.html
.... first thing that pops up with google.

Learning how to use sed to parse config files is a good way to learn bash
scripting.

For example the following sed script parses my samba config to get a list of
directories I need for my backup script and then deletes the backup listing.

sed -e '
/^$/ d
/#/ d
3,3 d
/\[/ !d
/^[<Tab><Space>] * $/ d
s/\[//
s/\]//
' </etc/samba/smb.conf>/usr/sbin/script/out
sed -i '/backup/ d' out

-----Original Message-----
From: olug-bounces at olug.org [mailto:olug-bounces at olug.org] On Behalf Of Amy
Mason
Sent: Tuesday, September 15, 2009 8:44 PM
To: OLUG at olug.org
Subject: [olug] Newbie Bash Scripting Tutorial

Hi,

I've been lurking around here for several months, since I used to come to
meetings before moving to Lincoln, but I was wondering if anyone has a good
idea where I can find a decent tutorial for bash scripting, as well as a
tutorial for filters on the command line. (Things like "sort" "comm" "tr",
piping and redirection, etc...  I'm in a Linux class now, and honestly not
getting as much out of my professor's lectures as I would hope, and really
could use the help.

Thanks,

Amy
_______________________________________________
OLUG mailing list
OLUG at olug.org
https://lists.olug.org/mailman/listinfo/olug




More information about the OLUG mailing list