#!/bin/csh -f

set pname=$0
set links=()
set extensions=()
set error=0
while ( $#argv >= 2 )
	set link="$1"
	shift
	set extension="$1"
	shift
	if ( -e "$link.$extension" ) then
		set links=($links:q $link:q)
		set extensions=($extensions:q $extension:q)
	else
		echo "${pname}: $link.$extension does not exists."
		set error=1
	endif
end
if ( $#argv > 0 ) then
	echo "${pname}: odd number of argument."
	echo "${pname} usage:"
	echo "	${pname} link extension [link extension]..."
	echo 'will do: ( rm ${link} ; ln -s ${link}.${extension} ${link} )...'
	set error=1
endif
if ( $#links == 0 ) then
	echo "${pname}: missing arguments."
	echo "${pname} usage:"
	echo "	${pname} link extension [link extension]..."
	echo 'will do: ( rm ${link} ; ln -s ${link}.${extension} ${link} )...'
	set error=1
endif
if ( $error != 0 ) then
	exit $error
endif
set i=1
while ( $i <= $#links )
	rm -f $links[$i]
	ln -s $links[$i].$extensions[$i] $links[$i]
	@ i++
end
exit 0

ViewGit