blob: f740aa03dc8de47c219b68c7fd4522f563b40136 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# A lone ( cd dir ) must put the shell back where it was.
start=$(pwd -P)
(cd /); echo "after=$? same=$([ "$(pwd -P)" = "$start" ] && echo yes || echo no)"
(cd /; pwd)
(cd / && pwd)
(cd /nonexistent) 2>/dev/null; echo "bad=$([ $? -ne 0 ] && echo nonzero) same=$([ "$(pwd -P)" = "$start" ] && echo yes || echo no)"
(cd /) 2>/dev/null; echo "redir=$? same=$([ "$(pwd -P)" = "$start" ] && echo yes || echo no)"
old=$OLDPWD
(cd /); echo "vars=$([ "$PWD" = "$start" ] && echo pwd) $([ "$OLDPWD" = "$old" ] && echo oldpwd)"
(cd /; :); echo "list=$? same=$([ "$(pwd -P)" = "$start" ] && echo yes || echo no)"
(cd /) || echo no
(cd /) && echo yes
( typeset -i PWD; (cd /) 2>/dev/null; echo "int=$? same=$([ "$(pwd -P)" = "$start" ] && echo yes || echo no)" )
readonly PWD
(cd /) 2>/dev/null; echo "ro=$? same=$([ "$(pwd -P)" = "$start" ] && echo yes || echo no)"
|