Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14834
| From | Alexander Reintzsch <Alexander.Reintzsch@netsystem.de> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | AW: Misbehavior with constants and bash script |
| Date | 2018-11-20 11:38 +0000 |
| Message-ID | <mailman.4299.1542713903.1284.bug-bash@gnu.org> (permalink) |
| References | <a4ad2b88-48a5-9569-716a-8e22cdb37dde@case.edu> |
Hello Chet, thank you for your help and pointing to the posix behavior. Quoting https://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html "[...] A non-interactive shell exits with an error status if a variable assignment error occurs when no command name follows the assignment statements. A variable assignment error occurs, for example, when trying to assign a value to a readonly variable. [...]" This helps. So what I need to do to force the script to proceed is to add another command after the assignment statement. Before ist was echo "A" declare -r vconst="I am fixed." echo "B" vconst="new value" # fails here echo "C" # never reached and if I add an empty command after the assignment statement it behaves as expected. echo "A" declare -r vconst="I am fixed." echo "B" vconst="new value" : # please note the : at the end. (no operation command) echo "C" # now printed End then it does not matter if bash is in posix mode or not. Thank you for your help in that matter. Cheers, Alex
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
AW: Misbehavior with constants and bash script Alexander Reintzsch <Alexander.Reintzsch@netsystem.de> - 2018-11-20 11:38 +0000
csiph-web