Red Hat Bugzilla – Bug 1459253
Bash consume exit code when keword "local" is used.
Last modified: 2017-06-12 22:36:33 EDT
Created attachment 1285465 [details]
Description of problem:
x=$(echo 33; exit 33)
returns exit code 33, but
local x=$(echo 33; exit 33)
Version-Release number of selected component (if applicable):
GNU bash, version 4.3.43(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2013 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.
f1 and f2 produce same output
Do you wish to report this bug for RHEL 5 or Fedora ? I see that you are running Fedora packages on your system. Also, is there something missing from your reproducer steps ? local keyword can be used only within functions. Please provide a full reproducer.
(In reply to Jakub Prokeš from comment #0)
> local x=$(echo 33; exit 33)
This is a known programming mistake in your code, not a bug in the interpreter: