tests: avoid triggering obsolete tail option processing
[coreutils.git] / tests / mv / i-4.sh
blob1a021d6d53fd67657378d120e1ec8859b760df93
1 #!/bin/sh
2 # make sure 'mv -i a b' does its job with a positive response
4 # Copyright (C) 2001-2024 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20 print_ver_ mv
22 for i in a b; do
23 echo $i > $i || framework_failure_
24 done
25 echo y > y || framework_failure_
26 echo n > n || framework_failure_
28 mv -i a b < y >/dev/null 2>&1 || fail=1
30 # Make sure out contains the prompt.
31 case "$(cat b)" in
32 a) ;;
33 *) fail=1 ;;
34 esac
36 # Ensure that mv -i a b works properly with 'n' and 'y' responses,
37 # when a and b are hard links to the same file.
38 rm -f a b
39 echo a > a
40 ln a b
41 mv -i a b < y 2>err && fail=1
42 test -r a || fail=1
43 test -r b || fail=1
44 printf "mv: 'a' and 'b' are the same file\n" > exp
45 compare exp err || fail=1
47 Exit $fail