cmv revision 1556
122347Spst# Copyright (c) 1991, 1993
222347Spst#	The Regents of the University of California.  All rights reserved.
329964Sache#
492906Smarkm# This code is derived from software contributed to Berkeley by
592906Smarkm# Kenneth Almquist.
622347Spst#
722347Spst# Redistribution and use in source and binary forms, with or without
822347Spst# modification, are permitted provided that the following conditions
922347Spst# are met:
1022347Spst# 1. Redistributions of source code must retain the above copyright
1192906Smarkm#    notice, this list of conditions and the following disclaimer.
1292906Smarkm# 2. Redistributions in binary form must reproduce the above copyright
1359118Skris#    notice, this list of conditions and the following disclaimer in the
1459118Skris#    documentation and/or other materials provided with the distribution.
1559118Skris# 3. All advertising materials mentioning features or use of this software
1659118Skris#    must display the following acknowledgement:
1729964Sache#	This product includes software developed by the University of
1829964Sache#	California, Berkeley and its contributors.
1929964Sache# 4. Neither the name of the University nor the names of its contributors
2022347Spst#    may be used to endorse or promote products derived from this software
2122347Spst#    without specific prior written permission.
2222347Spst#
2322347Spst# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2422347Spst# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2522347Spst# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2622347Spst# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2722347Spst# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2822347Spst# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2922347Spst# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3022347Spst# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3122347Spst# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3229964Sache# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3322347Spst# SUCH DAMAGE.
3422347Spst#
3522347Spst#	@(#)cmv	8.1 (Berkeley) 5/31/93
3622347Spst
3722347Spst# Conditional move--don't replace an existing file.
3822347Spst
3922347Spstcmv() {
4022347Spst	if test $# != 2
4122347Spst	then	echo "cmv: arg count"
4222347Spst		return 2
4322347Spst	fi
4429964Sache	if test -f "$2" -o -w "$2"
4522347Spst	then	echo "$2 exists"
4622347Spst		return 2
4722347Spst	fi
4822347Spst	/bin/mv "$1" "$2"
4922347Spst}
5022347Spst