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

28 lines, 14 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# ./declare.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -o errexit
9
10demo() {
11 readonly __ONE=bar # declare -r
12 export readonly __TWO=bar # declare -x
13 export readonly local __THREE=bar # declare -x
14 readonly __FOUR=bar
15 export __FOUR # declare -rx
16 # OK export readonly doesn't work! That was silly.
17 # not sure why I thought they can be combined.
18
19 # Show everything
20 declare -p | grep __
21}
22
23demo-clean() {
24 # Show a clean demo
25 env -i $0 demo
26}
27
28"$@"