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 16:37, Craig White wrote:
> On Mon, 2004-03-22 at 15:13, Jeremy C. Reed wrote:
> > On Mon, 22 Mar 2004, Craig White wrote:
> >
> > > 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
> >
> > I'd do something like:
> >
> > du -sh /home/* | while read line ; do
> >  i=`echo $line | cut -f1` ;
> >  if [ $i -gt $size_plateau ] ; then
> >    echo $i for `echo $line | cut -f2 | xargs -n 1 basename`
> >  fi
> > done
> ----
> I'm getting (as many as the value of $i) 
> ./chksize-users-profiles2: line 9: [: too many arguments

>
> which is the:
> if [ $i -gt $size_plateau ] ; then
> line
>
> - hmmm, I am trying to figure out where you are going with the xargs and
> basename commands...
>
> I certainly like your structure and I can see where I can have the value
> for -f1 & -f2 in the current but separate arrays much easier.

----
I will be dammed but I can't make the line above this one work...this is
where the problem is...
i=`echo $line | cut -f1`;

it doesn't cut...

#!/bin/sh
wfile1=/root/scripts/users-homes
wfile2=/root/scripts/profiles-exceed-limits
chdirect=/home/filesystems/samba/profiles
size_plateau=153600
du -s $chdirect/* | while read line ; do
i=`echo $line | cut -f1`;
# if [ $i -gt $size_plateau ]; then
# echo $i for `echo $line | cut -f2 | xargs -n 1 basename`
# fi
echo $i
done


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