~emersion/mrsh

ref: b73d3a4c2725da651efb408a2d78b9faabe7719c mrsh/test/word.sh -rw-r--r-- 632 bytes
b73d3a4cSimon Ser shell/task/word: add parameter plus op 2 years ago
                                                                                
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
#!/bin/sh

echo ""
echo "Tilde Expansion"
echo ~ ~/stuff # ~"/stuff"
echo ~root
#a=~/stuff
#echo $a

echo ""
echo "Parameter Expansion"
a=a
b=B
hello=hello
null=""
echo $a ${b} ">$a<"
echo \$a '$a'
echo ${a:-BAD} ${idontexist:-GOOD} ${null:-GOOD} ${idontexist:-}
echo ${a-BAD} ${idontexist-GOOD} ${null-BAD} ${null-}
echo ${a:+GOOD} ${idontexist:+BAD} ${null:+BAD} ${idontexist:+}
echo ${a+GOOD} ${idontexist+BAD} ${null-GOOD} ${null+}
#echo ${#hello}

echo ""
echo "Command Substitution"
echo $(echo asdf)
echo `echo asdf`

echo ""
echo "Arithmetic Expansion"
#echo $((1+2))

# Field Splitting
# Pathname Expansion
# Quote Removal