#!/bin/sh # unln makes a copy of a file and then unlinks the file and replaces it # with the copy. this is primarily useful with symlinks... and in # combination with the lndir command. r=0 for i in $*; do j=`mktemp -q -- "${i}.unln.XXXXXX"` if [ $? -ne 0 ]; then echo "$0: unable to mktemp ${i}.unln.XXXXXX, skipping" 1>&2 r=1 else cp -p -- "$i" "$j" && rm -- "$i" && mv -- "$j" "$i" fi done exit $r