On Sat, Jan 21, 2012 at 4:02 AM, Karl Vogel <vogelke+deb...@pobox.com> wrote: >>> On Thu, 19 Jan 2012 00:34:50 +0800, >>> lina <lina.lastn...@gmail.com> said: > > L> I am choked by how to check more than 400 files exist or not, if not, > L> sleep, but once it's all generated, continue do something. Those files > L> have a common feature: sys_em_$i.txt > > The script below doesn't do any glob-expansion of filenames, so it won't > barf if you have a lot of files. It assumes you're in the same directory > as the files you're checking. > > -- > Karl Vogel I don't speak for the USAF or my company > > A raccoon tangled with a 23,000 volt line today. The results blacked > out 1400 homes and, of course, one raccoon. --Steel City News > > -------------------------------------------------------------------------- > #!/bin/bash > export PATH=/usr/local/bin:/bin:/usr/bin > > case "$#" in > 0) echo need a number; exit 1 ;; > *) my_number=$1 ;; > esac > > while : > do > if [ $(find . -name 'sys_em_*.txt' -print | wc -l) == "$my_number" ]
-bash-3.2$ find . -name 'npt_*.gro' -print | wc -l 70 -bash-3.2$ if [ $(find . -name "npt_*.gro" -print | wc -l)==100 ] ; then echo 'success' break ; fi success break Thanks, but seems something weird here. it's not equal to 100. I just used this to test. > then > echo 'success' > break > fi > > echo 'test' > sleep 5 > done > > echo 'done' > exit 0 > > > -- > To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org > with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org > Archive: http://lists.debian.org/20120120200208.79090b...@kev.msw.wpafb.af.mil > -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/cag9cjmmkkpj9tideitxpu-nmhpxrv1yf1t_jh8x+ncbnvao...@mail.gmail.com