]> git.saurik.com Git - apple/shell_cmds.git/blame - sh/tests/builtins/cd1.0
shell_cmds-216.60.1.tar.gz
[apple/shell_cmds.git] / sh / tests / builtins / cd1.0
CommitLineData
deb63bfb 1# $FreeBSD: head/bin/sh/tests/builtins/cd1.0 228975 2011-12-30 00:04:11Z uqs $
71aad674
A
2set -e
3
4P=${TMPDIR:-/tmp}
5cd $P
6T=$(mktemp -d sh-test.XXXXXX)
7
8chmod 0 $T
9if [ `id -u` -ne 0 ]; then
10 # Root can always cd, regardless of directory permissions.
11 cd -L $T 2>/dev/null && exit 1
12 [ "$PWD" = "$P" ]
13 [ "$(pwd)" = "$P" ]
14 cd -P $T 2>/dev/null && exit 1
15 [ "$PWD" = "$P" ]
16 [ "$(pwd)" = "$P" ]
17fi
18
19chmod 755 $T
20cd $T
21mkdir -p 1/2/3
22ln -s 1/2 link1
23ln -s 2/3 1/link2
24(cd -L 1/../1 && [ "$(pwd -L)" = "$P/$T/1" ])
25(cd -L link1 && [ "$(pwd -L)" = "$P/$T/link1" ])
26(cd -L link1 && [ "$(pwd -P)" = "$P/$T/1/2" ])
27(cd -P link1 && [ "$(pwd -L)" = "$P/$T/1/2" ])
28(cd -P link1 && [ "$(pwd -P)" = "$P/$T/1/2" ])
29
30rm -rf ${P}/${T}