Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: number of arguments zargs use



On Sat, 30 Oct 2004, Motoi Washida wrote:

> This tries to get size of arguments allowed. I don't know this is 
> portable enough, but it seems to work for me.

This set me off wandering down the road to Obfuscatory ...

s=${${s##-(s|-max-chars(=|))}:-$(((s=$({command getconf ARG_MAX ||
    command sysctl -n kern.argmax || echo 0} 2>/dev/null))?
    (s-=${#$(builtin typeset +x)}+2048):20480))}

That would be equivalent to, though significantly less readable than, 
your patch, except that there is a bug in your patch:

> +    else
> +        s=-20480
> +    fi

That should be "s=20480", not -20480.  You'd never want a negative number
of characters.



Messages sorted by: Reverse Date, Date, Thread, Author