-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathoptions.yaml
106 lines (81 loc) · 1.79 KB
/
options.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: "Options"
cases:
- name: "Default options"
stdin: |
echo "Default options: $-"
- name: "set -a"
stdin: |
v1=1 v2=2 v3=3 v4=4 v5=(a b c)
declare -p v1 v2 v3 v4
set -a
v1=reassigned
v2+=appended
declare -i v3
v4+=(appended)
v5[2]=updated
v6=new
v7[0]=new
v8=(new)
declare v9=new
declare -a v10=(new)
declare -p v1 v2 v3 v4 v5 v6 v7 v8 v9 v10
- name: "set -n"
stdin: |
set -n
touch somefile.txt
ls
- name: "set -B"
stdin: |
set +B
echo "+B: " ${a,b}
set -B
echo "-B: " ${a,b}
- name: "set -t"
args: ["-t"]
stdin: |
echo first
echo second
- name: "set -C"
ignore_stderr: true
stdin: |
touch existing-file
set -C
echo hi > non-existing-file
echo "Result (non existing): $?"
echo "File contents: $(cat non-existing-file)"
echo
echo hi > /dev/null
echo "Result (device file): $?"
echo
echo hi > existing-file
echo "Result (existing file): $?"
echo "File contents: $(cat existing-file)"
echo
echo hi >| existing-file
echo "Result (clobber): $?"
echo "File contents: $(cat existing-file)"
echo
- name: "set -x"
stdin: |
set -x
ls
for f in 1 2 3; do echo ${f}; done
case 1 in
1) echo "1";;
*) echo "not";;
esac
while false; do
echo body
done
newvar=$(echo "new")
x=$((3 + 7))
if [[ x == 10 && ! 0 ]]; then
echo "Math checks"
fi
var="x"
[[ ${var} && ${var//[[:space:]]/} ]]
for ((i = 0; i < 3; i++)); do
echo $i
done
((x = 3)) || ((x = 4))
override=value echo some_output