BASH while [ ls "$1/tmp/" | wc -l -ge 3 ]; problem

John Dangler jdangler at terremark.com
Fri Nov 9 21:22:10 UTC 2007


On Fri, 2007-11-09 at 15:50 -0500, dave selby wrote:
> Hi all,
> 
> Stuck on bash, I need to execute a while loop while there are >= 3
> items in a dir. I tried
> 
> while [ ls "$1/tmp/" | wc -l -ge 3 ];
> 
> and I get ./kmotion_hkd.sh: line 33: [: missing `]'
for word in `ls ./`
do
  if [ `ls ./ | wc -l` -ge 3 ]
  then
    quit
  fi
  echo $word
done

> 
> --
> 
> Please avoid sending me Word or PowerPoint attachments.
> See http://www.gnu.org/philosophy/no-word-attachments.html
> 
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2151 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20071109/ff9c5946/attachment.bin>


More information about the ubuntu-users mailing list