bug-bash
[Top][All Lists]
Advanced

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

set command output is not reusable in POSIX mode


From: Stanislav Brabec
Subject: set command output is not reusable in POSIX mode
Date: Wed, 24 Nov 2004 15:54:43 +0100

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux
Compiler: gcc -I/usr/src/packages/BUILD/bash-3.0 
-L/usr/src/packages/BUILD/bash-3.0/../readline-5.0
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux' -DCONF_MACHTYPE='x86_64-suse-linux' -DCONF_VENDOR='suse' 
-DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H  -I.  
-I. -I./include -I./lib   -O2 -fmessage-length=0 -Wall -D_GNU_SOURCE -Wall 
-pipe -g -fbranch-probabilities
uname output: Linux hammer 2.6.8-24-default #1 Wed Oct 6 09:16:23 UTC 2004 
x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-suse-linux

Bash Version: 3.0
Patch Level: 0
Release Status: release

Description:

set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
              Without  options,  the  name  and value of each shell variable 
are displayed in a format that can be reused as
              input.  The output is sorted according to the current locale.

This is not true, if POSIX mode is on.

Repeat-By:

#! /bin/bash
POSIXLY_CORRECT=1
testvar=1
set >bashbug_temp
unset testvar
# this is ignored
set +e
. bashbug_temp
# This is not executed
echo "testvar should nov have value 1: $testvar"

Script output:
> sh bashbug1
bashbug_temp: line 3: BASH_VERSINFO: readonly variable

Fix:
Document this behavior. Add option, which skips readonly variables.

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SuSE CR, s. r. o.                             e-mail: sbrabec@suse.cz
Drahobejlova 27                               tel: +420 296 542 382
190 00 Praha 9                                fax: +420 296 542 374
Czech Republic                                http://www.suse.cz/





reply via email to

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