source: vendor/bash/3.1-p17/tests/tilde.tests

Last change on this file was 3228, checked in by bird, 18 years ago

bash 3.1

File size: 1.1 KB
Line 
1# this is needed because posix mode restricts tilde expansion to assignment
2# statements preceding a command, instead of the default of expanding all
3# assignment statements on the line (e.g., after `export'). Without this,
4# the next-to-last test fails
5set +o posix
6
7HOME=/usr/xyz
8SHELL=~/bash
9echo ~ch\et
10echo ~/"foo"
11echo "~chet"/"foo"
12echo \~chet/"foo"
13echo \~chet/bar
14echo ~\chet/bar
15echo ~chet""/bar
16echo ":~chet/"
17echo abcd~chet
18echo "SHELL=~/bash"
19echo $SHELL
20echo abcd:~chet
21path=/usr/ucb:/bin:~/bin:~/tmp/bin:/usr/bin
22echo $path
23
24cd /usr
25cd /tmp
26echo ~-
27echo ~+
28
29XPATH=/bin:/usr/bin:.
30
31# yes tilde expansion
32PPATH=$XPATH:~/bin
33echo "$PPATH"
34
35# no tilde expansion
36PPATH="$XPATH:~/bin"
37echo "$PPATH"
38
39# yes tilde expansion
40export PPATH=$XPATH:~/bin
41echo "$PPATH"
42declare -x PPATH=$XPATH:~/bin
43echo "$PPATH"
44
45# no tilde expansion
46export PPATH="$XPATH:~/bin"
47echo "$PPATH"
48declare -x PPATH="$XPATH:~/bin"
49echo "$PPATH"
50
51# more tests of tilde expansion when executing case commands
52case ~ in
53$HOME) echo ok 1;;
54*) echo bad 1 ;;
55esac
56
57case ~ in
58~) echo ok 2 ;;
59\~) echo bad 2a ;;
60*) echo bad 2b ;;
61esac
62
63case $unset in
64"") echo ok 3 ;;
65*) echo bad 3 ;;
66esac
Note: See TracBrowser for help on using the repository browser.