OILS / test / gold / readonly.sh View on Github | oilshell.org

24 lines, 14 significant
1#!/usr/bin/env bash
2
3set -o nounset
4set -o pipefail
5set -o errexit
6
7f1() {
8 local foo=bar
9 foo=1 # can modify it now
10 echo $foo
11
12 readonly foo # not anymore
13 #foo=2 # would cause an exception
14 echo $foo
15
16 echo done
17
18 # This is a GLOBAL, not a local
19 readonly f1_readonly=f1_readonly
20}
21
22f1
23
24echo $f1_readonly