CHUUG - Astronomy

About chuug...

Chuug (Charlottesville Unix Users Group) is a group users (ranging from hobbyist to professional) of Unix and Unix-like systems, with specific interests in astronomy and the moon, FreeBSD, and other free (i.e., open-source) systems (NetBSD, OpenBSD, etc.).
Chuug's inaugural meeting was held on Friday, April 10, 1998. Although many of its members are students at the University of Virginia, chuug is in no way affiliated with the University. All meetings are free and open to the public.

Unless otherwise specified, chuug meetings are held at 7:00 pm on the fourth Tuesday of each month at the NRAO auditorium. Other meetings and events will be announced through the mailing list. See also "chuug events and projects."

For more information on chuug, or to become a member, please contact Adrian Filipi-Martin.

chuug events & projects

Meetings are generally held at 7 PM on the 4th Tuesday of every month at the NRAO auditorium.

Information and slides for previous meetings are available here.

Next Meeting:
Intro and Advanced Bash Scripting
Josh Malone
April 24th, 2024
Abstract
I've been doing ~90% of my scripting in bash and I figured I'd share some of the advanced features of this great scripting language as well as provide a quick intro for those who've never experienced the bliss of scripting this shell. Hope to see you all there!

Bio:
Josh Malone is a unix/mac systems administrator for the National Radio Astronomy Observatory. He has been in the systems administration business for over 5 years at various companies in Charlottesville.

Download the slides in PDF format.

Member Reviews

Below are reviews of books, software and hardware by CHUUG members. All opinions expressed are those of the author and not of CHUUG

pring Into Technical Writing for Engineers and Scientists
Editor(s)/Author(s) Barry J. Rosenberg
Copyright 2005
Publisher Addison Wesley Professional
Book URL click here
ISBN 0131498630
Reviewer Vinay Igure
Review Date Feb. 16, 2006
The Book of Webmin ...or How I Learned to Stop Worrying and Love Unix
Editor(s)/Author(s) Joe Cooper
Copyright July 2003
Publisher No Starch Press
Book URL http://www.nostarch.com/webmin.htm
ISBN 1-886411-92-1
Reviewer Peter Gorsuch
Review Date November 29th, 2005
Make Magazine, Volume 3
Editor(s)/Author(s) Mark Frauenfelder
Copyright 2005
Publisher O'Reilly Media, Inc.
Book URL http://www.makezine.com
ISBN 0-596-10080-9
Reviewer Colin Steele
Review Date November 11, 2005
Open Source Security Tools: A Practical Guide to Security Applications
Editor(s)/Author(s) Tony Howlett
Copyright 2005
Publisher Prentice Hall
Book URL click here
ISBN 0321194438
Reviewer Timur Snoke
Review Date Oct. 2, 2004
sendmail Cookbook
Editor(s)/Author(s) Craig Hunt
Copyright 2003
Publisher O'Reilly Media, Inc.
Book URL click here
ISBN 0-596-00471-0
Reviewer Max Schubert
Review Date Sep. 26, 2004
Version Control with Subversion
Editor(s)/Author(s) Ben Collins-Sussman , Brian W. Fitzpatrick , C. Michael Pilato
Copyright 2004
Publisher O'Reilly Media, Inc.
Book URL click here
ISBN 0-596-00448-6
Reviewer Colin Steele
Review Date Aug. 16, 2004
Postfix: The Definitive Guide
Author Kyle D. Dent
Copyright 2003
Publisher O'Reilly Media, Inc.
Book URL click here
ISBN 0-596-00212-2
Reviewer Stephen L. Martin
Review Date July 11, 2004
Samba 3 by Example: Practical Exercises to Successful Deployment
Author John Terpstra
Copyright 2004
Publisher Prentice Hall
Book URL click here
ISBN 0-13-147221-6
Reviewer Josh Malone
Review Date April 21, 2004
Squid: The Definitive Guide
Author Duane Wessels
Copyright 2004
Publisher O'Reilly Media, Inc.
Book URL click here
ISBN 0-596-00162-2
Reviewer Stephen L. Martin
Review Date May 13, 2004
The Official Samba 3 HOWTO and Reference Guide
Editors John Terpstra and Jelmer Vernooij
Copyright 2004
Publisher Prentice Hall PTR
Book URL click here
ISBN 0-13-145355-6
Reviewer Josh Malone
Review Date Feb. 20, 2004
Building Secure Servers with Linux
Author Michael D. Bauer
Copyright 2003
Publisher O'Reilly and Associates
Book URL click here
ISBN 0-596-00217-3
Reviewer Mike Fehse
Review Date February 5th, 2004
Mandrake Linux 9.1
Copyright 2003
Publisher MandrakeSoft S.A.
Reviewer Mike Fehse
Review Date February 5th, 2004
Linux Network Administrator's Guide, 2nd Edition
Author Olaf Kirch and Terry Dawson
Copyright 2000
Publisher O'Reilly and Associates
Book URL click here
ISBN 1-56592-400-2
Reviewer Mike Fehse
Review Date January 22th, 2004
Open Source Network Administration
Author James M. Kretchmar
Copyright 2004
Publisher Prentice Hall
Book URL click here
ISBN 0-13-046210-1
Reviewer Stephen Martin
Review Date January 20th, 2004
Special Edition - Using Linux, 6th Edition
Author David Bandel and Robert Napier
Copyright 2001
Publisher Que Publishing
Book URL click here
ISBN 0789725436
Reviewer Mike Fehse
Review Date January 16th, 2004
Open Source Network Administration
Author James M. Kretchmar
Copyright 2004
Publisher Prentice Hall
Book URL click here
ISBN 0-13-046210-1
Reviewer Josh Malone
Review Date October 27th, 2003

Sponsors

Below is a list of entities (organizations, businesses, individuals, etc.) who have sponsored one re more aspects of CHUUG's activities, events and/or benefits.

NRAO Logo
National Radio Astronomy Observatory hosting our meetings, hosting our mailing lists

Ubergeeks Logo
Übergeeks Consulting web hosting, site maintenence, domain registration and pizza!

Codeweavers Logo
CodeWeavers Free software for member reviews. Discounts on software purchases. Ask Adrian Filipi for the CHUUG discount code. See this link for details of their users group program.

AW-BC Logo
Addison-Wesley/Prentice Hall Free books for member reviews.

O'reilly Logo
O'Reilly & Associates, Inc. Free books for member reviews. 20% discounts on O'Reilly, No Starch Press, Paraglyph Press and Syngress Publishing books and conferences. Ask Adrian Filipi for the CHUUG discount code. See this link their users group program details.

Peachpit Press Logo
Peachpit Press
Free books for member reviews. Specifically, CHUUG gets one new release per month. If there is one you would like to review, ask Adrian Filipi to put in a request.

Note that Peachpit Press now includes New Riders.

Que Logo
Que Publishing Free books for member reviews.

wrox logo Wrox Press Free review books.

nTelos Logo
nTelos Networks bandwidth and server hosting

chuug resources

Mailing List

A mailing list is graciously being hosted by the guys at NRAO. To subscribe, visit http://listmgr.cv.nrao.edu/mailman/listinfo/chuug.
The list address is chuug@nrao.edu, however it is a closed list, meaning no posts will be accepted from non-subscribers.

Propaganda

Chuug has also collected material that can be used to promote Linux, BSD, Unix, and (most importantly) our group. All of this material is conveniently available for you to download through your browser. See our Propaganda page.

News, Info, and other resources

Slashdot.org - Your source for current news and discussion
Linux.org

Linux Hardware Database (LhD) - A site for Linux users to share their opinions and experiences using different computer hardware under Linux. LhD is an independent, central database with an easy to use rating system. It also includes some information about device drivers and some hints for getting quirky devices working under Linux.

Sunsite - Tons of Linux files: applications, system utilities, kernels, HOWTOs, etc.

Redhat Advanced Development Labs (rhad) - Resolving all the usability issues, and then some

Mozilla.org - Netscape's release of the Mozilla (aka Navigator) source code is a major boost to the Open-source software movement

The GNU archives - GNU's Not Unix!

Linux Distributions

There are several "major" free Linux distributions available (in order of ease of install/setup/use):
RedHat - RedHat is the recommended distribution for true newbies (Wintendo 95 converts may find it particularly helpful), though it is certainly not limited to them. The reasoning behind the above statement is that RedHat has always focused on improving the ease of use/installation, and therefore has a very impressive set of installation scripts to make life easier for the beginner. In addition, they have a good software packaging system for ease of installation of software. Be Warned however - RedHat installs tend to take a lot of disk space by default, and cannot be done floppy-only. Also note: Shadowed passwords available at install time.

Debian - Debian is an excellent distribution, and blends features from both RedHat and Slackware. It is recommended for those with some prior experience (or the braver newbies). Debian has very good installation scripts (nearly on par with RedHat), a good package management system for ease of software installation, and yet is by default minimal (fully functional system can be installed from 5 floppies), yet with the packages is easily scaled to include whatever software you wish. Debian has been called the "real man's" Slackware ;) . Debian allows you to choose whether to use shadowed passwords during install.

Slackware - Slackware is the control-freak's installation. You can control exactly what is installed. There is very little hand-holding and only a minimal packaging system The system can be installed from floppies. It is recommended only for those with a considerable amount of experience with Linux and installations.

MkLinux - Mach microkernel Linux for the Power Mac (short description due to the author's utter lack of Mac experience...anyone familiar with it is more than welcome to send an informative description)

CD copies of these and other distributions can be purchased (or sometimes downloaded for CD-R) direct from the vendors as well as numerous other vendors. Places like Cheap*Bytes offer extremely affordable (~$2) CDs. In addition, there are various "commercial" distributions, including the "Official" RedHat release (includes commercial software like the Metro-X Xserver, and an paperback installation guide), Caldera (rumored to be available at the UVA bookstore), and SuSE.

BSD Distributions

FreeBSD
OpenBSD
NetBSD

Other Free Unix-like OSes

Minix - Minix has a history not unlike Linux. It was written by a collage professor (Andrew Tannenbaum) as an alternative to Unix. Unlike Linux, it wasn't open source, but was sold through a book publisher for about $150. The cost is what drove Linus Torvolds to write his Linux. Minix was put out under a freeware licence in 1996 and has been ported to almost every system imaginable (put it on that old 8086/amiga/atari ST/mac[runs in MacOS and on 68k!]) (See the Minix Information Sheet.)

MacMiNT - A Unix-like OS that was originally written for the Atari ST, but was later ported to Macintosh. It runs under MacOS and on any processor used in a Mac (untried below 68030, but will try on Mac Plus soon). It can run Bash, Tcsh, Man pages (most Unices that run on top of MacOS don't, at least not for free), Gcc, Elvis (a vi clone) and possibly others, if recompiled. MacMiNT is not open source, but it is freeware.

Advanced Bash Scripting
Joshua Malone (jmalone@ubergeeks.com
)
Why script in bash?
You’re probably already using it
Great at managing external programs
Powerful scripting language
Portable and version-stable
Almost universally installed
Basic syntax: statements and line format
Start the script with #!/path/to/bash like most scripts
Beware: /path/to/bash differs between unixes
...and even distros of Linux sigh
No semicolon at the end of a line
Semicolons can separate multiple statements on the same line
Most statements are either external programs or bash "builtins"
See man builtins
No parenthesis around function arguments
Basic syntax: variables
Variable assignment
FOO=BAR No spaces!
Variable expansion
$FOO
${FOO} Safer way -- brace protected
Basic syntax: conditional evaluation
IF statement
if command Command is any process that exists true or false
then
commands
else
commands
fi
You can use a semicolon to put more than one part of this structure on one line
if command ; then
Basic syntax: conditional evaluation
CASE statement
case variable in
condition1)
commands
;;
condition2)
commands
;;
) Default match
commands
;;
esac
condition statements are matched according to globbing rules (more later)
More bash syntax
While loop
while command
do
commands
done
For loop
for variable in list
do
commands
done
List is an IFS-separated list of literals or a variable containing one
IFS is the "inter-field separator" -- we’ll get to this later (usually a space)
External programs
It’s bash - just type the command :)
Capturing output of a command
FOO=‘prog‘ Backticks are more portable
FOO=$(prog) But parenthesis are easier to read, safer and also nest (more later)
Sending output to a command
echo $FOO | prog
Combining the two
FOO=$(echo $BAR | prog)
Background programs are post-fixed with an & just like normal
The special variable $! holds the PID of the last background task started
User output
Display output using echo builtin or an external program like printf
echo "foo" Outputs "foo" with trailing newline
echo -n "foo" Outputs "foo" but doesn’t send a newline
Escape sequences are parsed if the -e option to echo is given
echo -e "\tfoo" Outputs "foo" with a tab character in front and a trailing newline
User input
Read input from user using read
read foo Accepts user input and stores it into variable foo
read -p "string" foo Displays the prompt string and reads user input into foo
read -t 30 foo Read input into foo but time out after 30 seconds
read -s foo Read input into foo but don’t echo it to the terminal
Tests
Remember that if just tests the return value (true/false) of a command.
All tests are implemented in external binaries, especially the test or [ program
Types of tests
string (-z, =, !=, ...)
integer (-eq, -gt, -lt, ...)
file (-f, -d, -w, ...)
Basic Syntax
if [ $FOO = $BAR ]
if [ $count -lt 5 ]
See man test for more tests.
Basic math in bash
Bash has basic built-in INTEGER math evaluation using $(( expression ))
Examples:
echo $(( 4 + 5 )) - "9"
FOO=4
echo $(( $FOO + 5 )) - "9"
BAR=$(( 10 / 4 ))
echo $BAR - "2" Remember - integer math
For more complex math, or floating point, you’ll need to use and external
calculator like bc.
Command line arguments to scripts
The special variables $1, $2, etc., hold the arguments given on the command line
$0 the name of the script as excuted by the shell
$# the number of arguments passed to the script
$
is an IFS-separated list of all command line arguments
$@ is a list of all command line arguments individually double-quoted
The built-in command shift moves the CLA’s down (to the left) one and discards $1
($2 becomes $1, $3 becomes $2, etc.)
This can be used to iterate over the list or handle optional arguments
The external program getopt is also useful for processing a large number of arguments
Functions in bash
Declare function by placing parenthesis after the function name
Place function commands inside curly braces
function function_name () {
commands
}
The keyword "function" is not necessary but improves readability
Arguments to bash functions are accessed just like CLAs using $1, $2, etc.
Calling bash functions
To call a function, type it’s name like any other command
Arguments to bash functions are not put inside parenthesis
function foo () {
echo "Argument 1 is $1"
}
foo bar - outputs "Argument 1 is bar"
Shell globbing
Bash shell performs character matching against special symbols
process called "globbing"

When the script is finished

kill $LOGWIN
Example: Re-creating useful utils in bash
BSD has this great little utility called ’jot’ which can print a sequence of numbers
[user@host ~]# jot 5 10
10
11
12
13
14
This is espeically useful for creating the list needed for a ’for’ loop
Since I’ve never seen this for any Linux distros, I decided to just re-create it in bash.
My version will just print the numbers between $1 and $2 - good enough for me
Also be nice if it can zero-pad the numbers
Example: BSD jot in bash
function usage () {
cat EOF
Usage: $0 [-p length] start end
Generates a series of numbers from start to end in
interger steps.
-p n: pad smaller number out to n digits
EOF
exit 1
}
Example: BSD jot in bash (cont’)
padlen=0
if [ "$1" = ’-p’ ]; then
padlen="$2"
shift; shift
fi
[ -z "$2" ] && usage
begin=$1
end=$2
x=$begin
while [ $x -le $end ]; do
number=$x
if [ $padlen -gt 1 ]; then
while [ ${#number} -lt $padlen ]; do number="0${number}"; done
fi
echo -n "$number"
[ $x -lt $end ] && echo -n " "
x=$(( $x + 1 ))
done