Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14835
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: AW: Misbehavior with constants and bash script |
| Date | 2018-11-20 09:39 -0500 |
| Message-ID | <mailman.4300.1542724795.1284.bug-bash@gnu.org> (permalink) |
| References | <857e2280-38c5-344e-1916-17a6c6c61b02@netsystem.de> <a4ad2b88-48a5-9569-716a-8e22cdb37dde@case.edu> <1542713892292.1160@netsystem.de> |
On 11/20/18 6:38 AM, Alexander Reintzsch wrote: > 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 I would use `true'. `:' is a special builtin, and a POSIX interpretation clarified that a non-interactive shell is supposed to exit if a variable assignment error occurs when the assignment precedes a special builtin. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: AW: Misbehavior with constants and bash script Chet Ramey <chet.ramey@case.edu> - 2018-11-20 09:39 -0500
csiph-web