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

Nils Kassube kassube at gmx.net
Fri Nov 9 21:17:14 UTC 2007


dave selby wrote:
> 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 `]'

Try this (I haven't tested it though):

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


Nils




More information about the ubuntu-users mailing list