Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11483

`foo=1 declare -r foo' prints an error message but its exit status is zero

From ziyunfei <446240525@qq.com>
Newsgroups gnu.bash.bug
Subject `foo=1 declare -r foo' prints an error message but its exit status is zero
Date 2015-09-09 14:17 +0800
Message-ID <mailman.730.1441779466.19560.bug-bash@gnu.org> (permalink)

Show all headers | View raw


$ foo=1 declare -r foo
bash: foo: readonly variable
$ echo $?
0
$ echo $foo
1

Is this a bug? 

$ bar=1 readonly bar; # throw an error in Bash 4.2, fixed in Bash 4.3




Back to gnu.bash.bug | Previous | Next | Find similar


Thread

`foo=1 declare -r foo' prints an error message but its exit status is zero ziyunfei <446240525@qq.com> - 2015-09-09 14:17 +0800

csiph-web