Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: stty size doesn't work
On Sun, Oct 23, 2022 at 10:47 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> I doubt this is zsh's problem but she may have a solution just the same. I do this in my 'i' function:
>
> width=${=$( stty size )[2]}
>
> ... and it works fine, however if I call the function thusly:
>
> _function_test ()
> {
> local integer i=0
> while read aa; do
> let i++
> eval ${=aa} 2> /dev/null
> done
> }
>
> $ _function_test <<< "i path"
>
> ... 'width' is zero.
`stty size` needs the TTY as stdin. When you are invoking it from
_function_test, stdin is not a TTY. Use $COLUMNS instead. There is
also $LINES if you need height.
width=$COLUMNS
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author