[Top][All Lists]

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

readonly changes set -e behavior

From: Dennis Kuhn
Subject: readonly changes set -e behavior
Date: Tue, 21 Feb 2017 18:02:42 +0100


Configuration Information [Automatically generated, do not change]:
Machine: Mac
OS: Darwin
Compiler: gcc
Compilation CFLAGS: Xcode
uname output: Darwin dkuhn 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan  9 
23:07:29 PST 2017; root:xnu-3248. x86_64
Machine Type: x86_64-Apple-Darwin

Bash Version: 3.2
Patch Level: 48
Release Status: relase

Set a variable readonly changes the behavior of "set -e". Here is a small 

set -e

echo "abc"

This script exists with exit code 1 as expected after the subshell line.

When the variable s is set to readonly the script does not exit and echoes 

set -e

readonly s=$(false)
echo "abc"

This behavior is unexpected. I could reproduce the bug
on ubuntu 16.04 with bash version 4.3-14ubuntu1.1

Dennis Kuhn

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

reply via email to

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