2 # Test whether mv -n works as documented (not overwrite target).
4 # Copyright (C) 2006-2009 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 <http://www.gnu.org/licenses/>.
19 if test "$VERBOSE" = yes; then
27 # test miscellaneous combinations of -f -i -n parameters
28 touch a b || framework_failure
29 echo "\`a' -> \`b'" > out_move
32 # ask for overwrite, answer no
33 touch a b || framework_failure
34 echo n | mv -vi a b 2>/dev/null > out1 || fail=1
35 compare out1 out_empty || fail=1
37 # ask for overwrite, answer yes
38 touch a b || framework_failure
39 echo y | mv -vi a b 2>/dev/null > out2 || fail=1
40 compare out2 out_move || fail=1
42 # -n wins (as the last option)
43 touch a b || framework_failure
44 echo y | mv -vin a b 2>/dev/null > out3 || fail=1
45 compare out3 out_empty || fail=1
47 # -n wins (as the last option)
48 touch a b || framework_failure
49 echo y | mv -vfn a b 2>/dev/null > out4 || fail=1
50 compare out4 out_empty || fail=1
52 # -n wins (as the last option)
53 touch a b || framework_failure
54 echo y | mv -vifn a b 2>/dev/null > out5 || fail=1
55 compare out5 out_empty || fail=1
57 # options --backup and --no-clobber are mutually exclusive
58 touch a || framework_failure
59 mv -bn a b 2>/dev/null && fail=1