[aklug] Simplest way to do this in bash?

From: Christopher Howard <choward@indicium.us>
Date: Fri Jan 15 2010 - 01:11:57 AKST

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

My bash skills are a little weak. Okay, they are pretty much
non-existent past the common one-liners I use every day. So I would
appreciate any general suggestions or code:

Basic idea: I'm writing some tests for my Java class to make sure that,
as I continue to develop the codebase, my methods are still giving the
output I expect. So I want to write a bash script that executes a test
class, and then compares STDOUT to the contents of a file (which
contains the output I expect). If the two are exactly the same, then
script moves on to the next test, otherwise echoes a failure message and
dies with a bad return value.

Like so

 #
 # ... compiles all the code ...
 # ... I can write that part ...
 #

 # execute java test program
 java -cp ".;../" TestMyClass

 # then compare STDOUT of previous cmd
 # to contents of file TestMyClass.dat

 # If contents are different then
 echo "TestMyClass failed!"
 # then die with bad return value

 # If contents are the same
 # continue script...

- --
Christopher Howard
http://indicium.us
http://theologia.indicium.us
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAktQP20ACgkQQ5FLNdi0BcXcqwCeJyPQ6u/BuJGbzdlbOc2U5CDL
mb0An0upUB4rttxa20EEhVblqkLCYIqG
=tMaZ
-----END PGP SIGNATURE-----
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Fri Jan 15 01:11:43 2010

This archive was generated by hypermail 2.1.8 : Fri Jan 15 2010 - 01:11:43 AKST