summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-08-04 15:23:32 +0000
committerJim Meyering <jim@meyering.net>2001-08-04 15:23:32 +0000
commite302d9c5718f70370546b736e0844fbbad84c93d (patch)
tree495c6c5b8343c4b9ea99a1ec92937a97299fb8c3 /tests
parent4475c1fb999aa4e8b49946cf80e5fb9712d3348a (diff)
downloadcoreutils-e302d9c5718f70370546b736e0844fbbad84c93d.tar.xz
*** empty log message ***
Diffstat (limited to 'tests')
-rwxr-xr-xtests/mv/i-343
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/mv/i-3 b/tests/mv/i-3
new file mode 100755
index 000000000..24e0e737f
--- /dev/null
+++ b/tests/mv/i-3
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Make sure `mv file unwritable-file' prompts the user.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ mv --version
+fi
+
+. $srcdir/../envvar-check
+. $srcdir/../lang-default
+. $srcdir/../root-only
+
+pwd=`pwd`
+tmp=mv-i.$$
+trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+trap '(exit $?); exit' 1 2 13 15
+
+framework_failure=0
+mkdir $tmp || framework_failure=1
+cd $tmp || framework_failure=1
+touch f g || framework_failure=1
+chmod 0 g || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo 'failure in testing framework' 1>&2
+ (exit 1); exit
+fi
+
+fail=0
+
+ls /dev/stdin >/dev/null 2>&1 \
+ || { (exit 77); exit; }
+mv f g < /dev/stdin > out 2>&1 & pid=$!
+sleep 1
+kill $pid
+
+# Make sure out contains the prompt.
+case "`cat out`" in
+ "mv: overwrite \`g', overriding mode 0000?"*) ;;
+ *) fail=1 ;;
+esac
+
+(exit $fail); exit