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    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to