[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash help please



On Thursday 09 June 2016 23:50:35 David Wright wrote:

> On Thu 09 Jun 2016 at 22:41:27 (-0400), Gene Heskett wrote:
> > A bash script that has worked most of a decade now refuses.
> >
> > For instance, assume that var InMail is = "gene", and can be echoed
> > from the command line using $InMail like this.
> > gene@coyote:~$ echo $InMail
> > gene
> > But I'll be switched if I can get a result from a line of code
> > resembling this from the command line while attempting to
> > troubleshoot a 110 line bash script: which asks "if test [${InMail}
> > = "gene"]
> > 			  then
> > 				-----
> > 			 elif (another name)
> > 				yadda yadda
> >
> > gene@coyote:~$ echo `test [${InMail} = "gene"]`
> >
> > All I get is the linefeed.  Obviously I'm losing it, so how do I
> > translate and get usefull output for troubleshooting?
>
> $ `[ ${InMail} = "gene" ]` ; echo $?
> 0
> $ `[ ${InMail} = "xgene" ]` ; echo $?
> 1
> $ `test ${InMail} = "gene"` ; echo $?
> 0
> $ `test ${InMail} = "xgene"` ; echo $?
> 1
> $
>
> elif needs [], not (), and it needs a then too.
>
> [ is a command like test, so it must be followed by a space
> before its argument.
>
> Often the easiest way of solving these is grep -A ... used with
> /etc/init.d/*

This script is home brew, and has never had a starter in /etc/init.d
Its normally something I start after the kmail gui is up and running.  
But restarting tdm-trinity apparently doesn't kill any background 
daemons which this normally runs as, and the excessive downtime of kmail 
let it stuff dcops buffer full, and then everything that needed dcop 
promptly fell over too, including cups.

The only recovery from that is a reboot which I did, but I screwed the 
pooch on this script before the reboot.  Big dummy at work of course.  
BTDT, 50 times or more over the last decade plus I've been doing this to 
offload the mail fetching from kmail as it locks up everything while its 
doing that, 5 minutes plus at a time back when  all this was done on 
dialup on a 2400 baud modem.  Thats possibly before some peoples time 
here on this list. :)

And I just amrecover'd a week old version that is working fairly well 
although its burning up the shell history file since I put a set -x in 
the top of it.  So I can at least go get some zz's.

> Cheers,
> David.

Thanks David, I'll hit on this again on another day.


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>


Reply to: