181235dd6f34cbf0aeb7be64f7c4896a0747ab93
[dragonfly.git] / tools / regression / bin / sh / builtins / cd8.0
1 # $FreeBSD: src/tools/regression/bin/sh/builtins/cd8.0,v 1.1 2012/01/13 23:32:27 jilles Exp $
2
3 # The exact wording of the error message is not standardized, but giving
4 # a description of the errno is useful.
5
6 LC_ALL=C
7 export LC_ALL
8 r=0
9
10 t() {
11         exec 3>&1
12         errmsg=`cd "$1" 2>&1 >&3 3>&-`
13         exec 3>&-
14         case $errmsg in
15         *[Nn]ot\ a\ directory*)
16                 ;;
17         *)
18                 printf "Wrong error message for %s: %s\n" "$1" "$errmsg"
19                 r=3
20                 ;;
21         esac
22 }
23
24 t /dev/tty
25 t /dev/tty/x
26 exit $r