]>
Commit | Line | Data |
---|---|---|
8868edaf CR |
1 | # This program is free software: you can redistribute it and/or modify |
2 | # it under the terms of the GNU General Public License as published by | |
3 | # the Free Software Foundation, either version 3 of the License, or | |
4 | # (at your option) any later version. | |
5 | # | |
6 | # This program is distributed in the hope that it will be useful, | |
7 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
8 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
9 | # GNU General Public License for more details. | |
10 | # | |
11 | # You should have received a copy of the GNU General Public License | |
12 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
13 | # | |
95732b49 JA |
14 | HOME=/usr/xyz |
15 | XPATH=/bin:/usr/bin:. | |
16 | ||
17 | ADDPATH=PATH=~/bin:$XPATH | |
18 | ||
19 | echo $ADDPATH | |
20 | ||
21 | unset ADDPATH | |
22 | : ${ADDPATH:=~/bin:~/bin2:$XPATH} | |
23 | echo $ADDPATH | |
24 | ||
25 | unset ADDPATH | |
26 | : ${ADDPATH:=PATH=~/bin:~/bin2:$XPATH} | |
27 | echo $ADDPATH | |
28 | ||
29 | cat << ! | |
30 | ~/bin | |
31 | ! | |
32 | ||
33 | echo "~" | |
34 | ||
35 | echo ${TPATH:-~} | |
36 | echo "${TPATH:-~}" | |
37 | echo "${TPATH:-"~"}" | |
38 | ||
39 | echo "${XPATH+~}" | |
40 | ||
41 | recho "\a" | |
42 | recho "${TPATH:-\a}" | |
43 | ||
44 | SHELL=~/bash | |
45 | echo $SHELL | |
46 | ||
47 | case $SHELL in | |
48 | ~/bash) echo ok;; | |
49 | *) echo bad;; | |
50 | esac | |
51 | ||
52 | somevar= | |
53 | echo "${somevar:-~}" | |
54 | echo "${somevar:-"~"}" | |
55 | ||
56 | echo make -k FOO=~/mumble | |
57 | ||
58 | typeset FOO=~/mumble | |
59 | echo "$FOO" | |
60 | ||
61 | h=HOME=~ | |
62 | echo $h | |
63 | ||
64 | export h=HOME=~ | |
65 | echo $h | |
66 | ||
67 | x=1234 | |
68 | HOME='/usr/$x/abc' | |
69 | ||
70 | echo ~ | |
71 | ||
72 | # behavior differs here in posix mode | |
73 | set -o posix | |
74 | ||
75 | eval echo $h | |
76 | eval $h | |
77 | echo $HOME | |
78 | ||
79 | set +o posix | |
80 | ||
81 | eval echo $h | |
82 | eval $h | |
83 | echo $HOME |