[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to check 400 files exist



On 19/01/12 11:29, Wawrzek Niewodniczanski wrote:
On 01/19/12 03:04, lina wrote:

[...]
Thanks,
but here it complains so many $ ./check_file.sh
./check_file.sh: line 8: [: too many arguments

Possible problem with spaces. This one works for me:

No, the problem is the number of arguments to the ls call.
There is a limited number of arguments for a process, and
the glob sys_em_*.txt expanded to more than that number.

my_number=400
while :
do
if [ `ls -1 sys_em_*.txt | wc -l` == "$my_number" ]

^ this will suffer the same problem, for some quantity of matches to sys_em_*.txt.

The best solutions in this thread so far used a naive counting loop
and a counter variable.


Reply to: