ot, bash programming question

Janina Sajka janina at rednote.net
Sat Apr 7 22:02:29 EDT 2012


Hi, Greg:

Tacking my two cents onto this old thread, I simply want to point you to
my favorite BASH scripting reference, Mendel Cooper's Advanced Bash Scripting
Guide. The section on exit codes and exit status is at:

http://tldp.org/LDP/abs/html/exit-status.html

hth

Janina

Gregory Nowak writes:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Thanks to everyone who replied. All the suggestions I got were very
> helpful, and showed me what I wanted to know.
> 
> Greg
> 
> 
> On Thu, Mar 29, 2012 at 05:28:45AM -0400, Storm Dragon wrote:
> > Hi,
> > You are getting the error because you are using the wrong test for your
> > variable. When doing math based comparisons you need to use switches
> > like -ne for noot equals. Here are a few and what they mean:
> > -ne not equals !=
> > -eq equals ==
> > -gt greater than >
> > -lt less than <
> > So here is your code with a couple modifications that will hopefully
> > make it easier to understand:
> > #!/bin/bash
> > 
> > > #execute program
> > > ./program.sh
> > > #if program exited abormally will return a 1, usually  returns 0 if completed successfully
> > > if [ $? -eq 1 ] ; then
> > > echo "returned 1"
> > > fi
> > > 
> > > HTH
> > > Storm
> > > 
> > 
> > 
> > -- 
> > Vinux Publicity Coordinator: http://www.vinuxproject.org/
> > Registered Linux user number 508465: https://linuxcounter.net/user/508465.html
> > My blog, Thoughts of a Dragon: http://www.stormdragon.us/
> > Need a safe and easy way to backup and share files? Try Dropbox: http://db.tt/jeY50HR
> > "Yeah my whole family done give up on me, and it makes me feel oh so bad. The only one who'll hang out with me is my dear ol' grand dad, and we drink alone."
> > George Thorogood - I Drink Alone
> > 
> > 
> > 
> 
> 
> - -- 
> web site: http://www.romuald.net.eu.org
> gpg public key: http://www.romuald.net.eu.org/pubkey.asc
> skype: gregn1
> (authorization required, add me to your contacts list first)
> 
> - --
> Free domains: http://www.eu.org/ or mail dns-manager at EU.org
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> 
> iEYEARECAAYFAk90tisACgkQ7s9z/XlyUyCqeQCgqL/OlqQfgKHu0lvNilnWVX/a
> 5SoAn35+OH78ha9d3TnB+KBHO6B6Rpk6
> =4CXh
> -----END PGP SIGNATURE-----
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup

-- 

Janina Sajka,	Phone:	+1.443.300.2200
		sip:janina at asterisk.rednote.net

Chair, Open Accessibility	janina at a11y.org	
Linux Foundation		http://a11y.org

Chair, Protocols & Formats
Web Accessibility Initiative	http://www.w3.org/wai/pf
World Wide Web Consortium (W3C)




More information about the Speakup mailing list