xref: /original-bsd/bin/sh/funcs/cmv (revision b3c06cab)
1# Copyright (c) 1991, 1993
2#	The Regents of the University of California.  All rights reserved.
3#
4# This code is derived from software contributed to Berkeley by
5# Kenneth Almquist.
6#
7# %sccs.include.redist.sh%
8#
9#	@(#)cmv	8.2 (Berkeley) 05/04/95
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}
24