Denys Vlasenko | 38ef39a | 2017-07-18 01:40:01 +0200 | [diff] [blame^] | 1 | readonly a=A |
| 2 | b=B |
| 3 | readonly b |
| 4 | # readonly on already readonly var is harmless |
| 5 | readonly b a |
| 6 | readonly | grep '^readonly [ab]=' |
| 7 | # this should work |
| 8 | export a b |
| 9 | export -n a b |
| 10 | echo Ok:$? |
| 11 | env | grep -e^a= -e^b= # shows nothing |
| 12 | |
| 13 | # these should all fail (despite the same value being assigned) |
| 14 | # bash does not abort even in non-interactive more (in script) |
| 15 | true |
| 16 | a=A |
| 17 | echo Fail:$?; true |
| 18 | readonly a=A |
| 19 | echo Fail:$?; true |
| 20 | export a=A |
| 21 | echo Fail:$?; true |
| 22 | a=A echo Visible:$? # command still runs |
| 23 | unset a |
| 24 | echo Fail:$?; true |