zsh-workers
 help / color / mirror / code / Atom feed
From: Clint Hepner <clint.hepner@gmail.com>
To: Manfred Lotz <manfred.lotz@arcor.de>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Length of argument list
Date: Wed, 10 Jun 2015 17:46:24 -0400	[thread overview]
Message-ID: <CAKjp4B65KTm+FhFbmb8jMBoyrkbOAWUGgQDa6fAr5AGKUj51fQ@mail.gmail.com> (raw)
In-Reply-To: <20150610204814.4aa2f5aa@hogwart.bsdlocal.net>

[-- Attachment #1: Type: text/plain, Size: 640 bytes --]

This is the wrong way to count files in the first place; any matching file
names containing newlines (yes, they're legal) would give the wrong count.

One alternative is

    a=( manyfiles/* )
    echo ${#a}

to create an array containing all the file names, then check the number of
elements in the array.

On Wed, Jun 10, 2015 at 2:48 PM, Manfred Lotz <manfred.lotz@arcor.de> wrote:

> Hi all,
> I created 1 million files in a directory callend manyfiles/.
>
> Now
> ls manyfiles/* |wc -l
>
> gives
> zsh: argument list too long: ls
>
>
> Question: Is there a way to change the maximum size of the argument
> list?
>
>
>
> --
> Manfred
>

  parent reply	other threads:[~2015-06-10 21:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10 18:48 Manfred Lotz
2015-06-10 20:09 ` Mikael Magnusson
2015-06-11  9:23   ` Manfred Lotz
2015-06-10 21:46 ` Clint Hepner [this message]
2015-06-11  9:27   ` Manfred Lotz
2015-06-11 13:20     ` Stephane Chazelas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKjp4B65KTm+FhFbmb8jMBoyrkbOAWUGgQDa6fAr5AGKUj51fQ@mail.gmail.com \
    --to=clint.hepner@gmail.com \
    --cc=manfred.lotz@arcor.de \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).