Chris Down dixit:

>If you really care, any POSIX shell should be able to do this as long
>as you don't hit ARG_MAX:
>
>  set -- * && echo "$#"

I think ARG_MAX may not be relevant here… but globbing * usually
sorts, and shells don’t always use the fastest algorithms…

… but OTOH, if you have that large directories, you have all
sorts of other problems. “DDTT” and “KISS”, while not always
available, are good suggestions ;-)

bye,
//mirabilos
-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
        -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

Reply via email to