On 19/01/2012 04:51, Anand Sivaram wrote:
2012/1/19 lina <lina.lastn...@gmail.com <mailto:lina.lastn...@gmail.com>>
On Thu, Jan 19, 2012 at 1:35 AM, Wawrzek Niewodniczanski
<wawrzek.niewodniczan...@citrix.com
<mailto:wawrzek.niewodniczan...@citrix.com>> wrote:
> On 01/18/12 16:34, lina wrote:
>
> Hi,
>
> Thanks ahead for reading this email.
>
> I am choked by how to check more than 400 files exist or not, if
not,
> sleep, but once it's all generated, continue do something.
>
> for i in $(seq 5); do if [ -e sys_em_$i.txt ] ; then echo done ;
fi ;
> done not work.
>
> those files have a common feature:
>
> sys_em_$i.txt
>
> What about using `ls -1 sys_em_*.txt | wc -l` to check the
number of
> files.
>
> I.e. (I hope it works):
>
> my_number = 400
> while :
> do
> if [ ` ls -1 sys_em_*.txt | wc -l` == "$my_number" ] then
Thanks,
but here it complains so many $ ./check_file.sh
./check_file.sh: line 8: [: too many arguments
> break
> sleep 5
> fi
> done
>
> Thanks,
> Wawrzek
> --
> Wawrzyniec (Wawrzek) NiewodniczaĆski - (niewod @ LinkedIn)
> System Administrator - Engineering Services Team (XenServer)
> Citrix Systems, Building 101, Cambridge Science Park, CB4 0FY,
Cambridge
> PhD in Quantum Chemistry, MSc in Molecular EngineeringM
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
<mailto:debian-user-requ...@lists.debian.org>
with a subject of "unsubscribe". Trouble? Contact
listmas...@lists.debian.org <mailto:listmas...@lists.debian.org>
Archive:
http://lists.debian.org/cag9cjmmool1faqac6rrgsje74bw0uv2nbp79dgz6j6eljp...@mail.gmail.com
How about this
m=0; # missing
n=0; #not missing
for ((k=0;k<400;k++))
do
if [ -e sys_em_$k.txt ]
then
n=$(expr $n + 1)
else
m=$(expr $m + 1)
fi
done
echo "missing = " $m
echo "not missing = " $n
--
http://saurorja.org
Twitter: @anand_sivaram
sorry I don't understand you. What is your aim?
There are around 400 file (like 0k, 1k, 2k, ....399k, 400k, 401k) in the
dir and you want to determine how many missing?