Hi Andreas, Sure, the variables explicitly assigned to get exported, that is the expected behavior. But there is nothing which explains why the variable COLUMNS becomes an environment variable.
OK. The description of COLUMNS says: 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.
Run “ps ax” twice and the results of the second execution is different from the first if and only if “set -a” was called fiirst. This is NOT an expected behavior.
You have checkwinsize set. The description of checkwinsize reads: checkwinsize If set, bash checks the window size after each external (non-builtin) command and, if necessary, updates the values of LINES and COLUMNS. This option is enabled by default. So the first invocation of ps, since it's a non-builtin command, makes bash query the terminal and adjust LINES and COLUMNS.
Do the following and you won’t get a problem: set -a var1=xx var2=xx set +a
All builtin commands.
All is fine, but do the following and COLUMNS gets exported: set -a echo $PATH | grep xxx/scripts || PATH=${PATH}:/newdir ps ax is now truncated, definitely NOT expected
The value of COLUMNS gets modified, and auto-exported since you have `set -a' enabled. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature