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

Path csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.ripco.com!news.glorb.com!usenet.stanford.edu!not-for-mail
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 Wed, 9 Sep 2015 14:17:30 +0800
Lines 15
Approved bug-bash@gnu.org
Message-ID <mailman.730.1441779466.19560.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0 (Mac OS X Mail 7.3 \(1878.2\))
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1441779466 10825 208.118.235.17 (9 Sep 2015 06:17:46 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201307; t=1441779453; bh=5lUrOmbxOouLXyxL/HAZYu+rFCc7/WLJx/G+IhZNiVQ=; h=From:Content-Type:Content-Transfer-Encoding:Subject:Message-Id:Date:To:Mime-Version; b=SvJ8+17K2Op0LYc7gIAMslk1ASHl91EcCXEx5H5zE2WZAdPV11EwILEHshiyBI5ls OHDmBnC9q1iXNODEdLuCmvca760H3TSQQKWW186aR96DsvCahTKWJzW3jjp5y3q64Z i3KiQ/pm5rNv4CkHrfkfoKeHfTeqh8e17GamjTVg=
X-QQ-mid esmtp38t1441779451t570t23386
X-QQ-SSF 0100000000000010F0K01F00000000G
X-QQ-FEAT jLTfbrzLdoNugWoEGoOFG/XKrmK5P60JBYwxoAoNwl3rd8yftK71KajnTmrq2 6qFrCKMOcvioOn6UltKrEAcHj9P0hZYrKVtLQ6arLYXz1olLcb3Jbra5UnbgLlK9Nie647e ucjC45T3Bllyx5KCZfpMqHoDoOEzAcwfxwLKKwNkKwt8yGiWCWF/+pzy6MuePSBM38OVVGs z/oW3//8ueHxe3WESKwfD6j8DNVHOMnc=
X-QQ-GoodBg 0
X-Mailer Apple Mail (2.1878.2)
X-QQ-SENDSIZE 520
X-QQ-Bgrelay 1
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.4.x
X-Received-From 184.105.206.29
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11483

Show key headers only | 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