On Mon, 4 Mar 2002, Alister Waller wrote:

> Hi,
> 
> I have a shell script that I am trying to tidy up a bit by creating
> variables and looping around to process things rather than have multiple
> lines of the same code.
> 
> I have a companies file that contains RR and XX
> 
> What I want is for the script to process the export for each company in the
> companies file and check to see if that companies export flag is set to YES,
> if so do the export, if not then miss it out.
> 
> I have an example below:
> 
> #!/bin/bash
> 
> RRexportflag=yes
> XXexportflag=no
> 
> for i in `cat companies`
> do
> 
> if [ $iexportflag = "yes" ] ; then
> 
> ...do some exporting ...
> 
> fi
> done

After reading a few other posts I think I get it.
#!/bin/bash

RRexportflag=yes
XXexportflag=no
ef=exportflag

for i in `cat companies`
do
if [ "$i$ef" = "yes" ]; then
... do some exporting
fi
done

-- 
---<GRiP>--- 
Web: www.arcadia.au.com/gripz 
Answering Machine/fax: 02 4950 1194 (wait 5 mins if no answer)
Mobile: 0408 686 201

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to