Re: stupid shell tricks again

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
To: plug-discuss
Subject: Re: stupid shell tricks again
On Mon, 2004-03-22 at 14:54, Bill Jonas wrote:
> On Mon, Mar 22, 2004 at 02:48:26PM -0700, Craig White wrote:
> > for i in `cut -f1 $wdirect/users-homes`; do if [ $i > $size_plateau ];
> > then `echo $i`; fi; done
>
> I think you want '-gt' instead of '>'. > is a shell metacharacter,
> remember. See test(1) for other operators and more info.

----
Yeah, I got it via another route, apparently the [ ] are for text based
evals or the text based mathematical operators and the (( )) is purely
mathematical container. I think the BASH book I got sucks. Learning the
bash Shell (O'Reilly). Found much better info (for me at least - dummy
level) on a web site.

I'm now up to ...
for i in `cut -f1 $wdirect/users-homes`; do result=$(( $size_plateau -
$i )); if (($result<=0)); then `echo $i`; fi; done

so it's time to use the grep thought that Jeremy had

Craig

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss