help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Why COLUMNS is not available, when -i is set?


From: Chet Ramey
Subject: Re: [Help-bash] Why COLUMNS is not available, when -i is set?
Date: Thu, 12 Mar 2015 12:03:26 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 3/11/15 9:18 PM, Peng Yu wrote:
> The manual says the following.
> 
>         -i        If the -i option is present, the shell is interactive.

Yes, in the OPTIONS section, describing the behavior of invocation options.
You left out the sentence that reads "In addition, bash interprets the
following options when it is invoked."  Don't be disingenuous about it.

> 
>         COLUMNS
>                Used by the select compound command to determine the
> terminal width when printing  selection
>                lists.   Automatically  set if the checkwinsize option
> is enabled or in an interactive shell
>                upon receipt of a SIGWINCH.
> 
> However, when I try the following code. The variable $COLUMNS is not
> available. Is it possible to somehow enable COLUMNS in a bash script?

Sure.  Export it from the parent shell, set checkwinsize, and run a
non-builtin command.  Bash doesn't check whether the window size changes
after a builtin command.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]