Bug: bash -e misbehaves with several nested
Pavel Fedin
p.fedin@samsung.com
Wed May 24 15:55:00 GMT 2017
Hello! I'd like to report a strange bug in 64-bit bash. The following script:
---- cut ---
#/bin/bash -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo Works: $DIR
---- cut ---
Simply exits and produces no output (never reaches echo). The same script works perfectly on 32 bits. Versions are the same:
--- cut ---
$ bash --version
GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
--- cut ---
(of course i686 version prints "i686-pc-cygwin" here)
If i remove "-e" argument, it starts working. If i break down the sequence into two lines:
--- cut ---
#/bin/bash -e
DIR="$( dirname "${BASH_SOURCE[0]}" )"
DIR="$( cd "$DIR" && pwd )"
echo Result: $DIR
--- cut ---
then it also works on both versions of Cygwin.
Kind regards,
Pavel Fedin
Senior Engineer
Samsung Electronics Research center Russia
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list