4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / bin / sh / funcs / cmv
CommitLineData
d1b73048
KB
1# Copyright (c) 1991, 1993
2# The Regents of the University of California. All rights reserved.
7f6665ab
KB
3#
4# This code is derived from software contributed to Berkeley by
5# Kenneth Almquist.
6#
7# %sccs.include.redist.sh%
8#
d1b73048 9# @(#)cmv 8.1 (Berkeley) %G%
7f6665ab
KB
10
11# Conditional move--don't replace an existing file.
12
13cmv() {
14 if test $# != 2
15 then echo "cmv: arg count"
16 return 2
17 fi
18 if test -f "$2" -o -w "$2"
19 then echo "$2 exists"
20 return 2
21 fi
22 /bin/mv "$1" "$2"
23}