coreutils/tests/mkdir/special-1

42 lines
689 B
Plaintext
Raw Normal View History

2000-04-27 14:30:59 +08:00
#!/bin/sh
# verify that mkdir honors special bits in MODE
if test "$VERBOSE" = yes; then
set -x
$mkdir --version
fi
tmp=mkdir-sp-$$
trap 'status=$?; rm -rf $tmp && exit $status' 0
trap 'exit $?' 1 2 13 15
2000-04-27 14:36:05 +08:00
numeric_mode=2755
mode_string=drwxr-sr-x
mkdir -m$numeric_mode $tmp || fail=1
2000-04-27 14:30:59 +08:00
test -d $tmp || fail=1
set -- `ls -ld $tmp`
case "$1" in
2000-04-27 14:36:05 +08:00
$mode_string) ;;
2000-04-27 14:30:59 +08:00
*) fail=1 ;;
esac
2000-04-27 14:34:07 +08:00
rmdir $tmp || fail=1
tmp2=$tmp/sub
# This should fail.
2000-04-27 14:36:05 +08:00
mkdir -m$numeric_mode $tmp2 2> /dev/null && fail=1
2000-04-27 14:34:07 +08:00
# Now test the --parents option.
2000-04-27 14:36:05 +08:00
mkdir --parents -m$numeric_mode $tmp2 || fail=1
2000-04-27 14:34:07 +08:00
test -d $tmp2 || fail=1
set -- `ls -ld $tmp2`
case "$1" in
2000-04-27 14:36:05 +08:00
$mode_string) ;;
2000-04-27 14:34:07 +08:00
*) fail=1 ;;
esac
2000-04-27 14:30:59 +08:00
exit $fail