Chris Wedgwood:
> How about the following?

>           local NLINK=`readlink "$DEST"`
>           if [ ! -e "$NLINK" ] ; then

You lose if the link is relative and the symlink is not in the current
directory. You also lose on systems where the empty filename is
synonymous with the current directory.

You'd need to do something along the lines of

        if [ -n "$NLINK" ] ; then
                case "$NLINK" in
                /*) ;;
                *) NLINK="$(dirname "$DEST")/$NLINK" ;;


>               # dangling link, just poke as-is
>               echo "$1" > "$DEST"

You should remove "DEST first. Otherwise, under Linux, you'll magically
create the file the symlink points to, which may not be what you want to

Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  [EMAIL PROTECTED]
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
Custom does often reason overrule And only serves for reason to the fool.
                                        -- John Wilmot, Earl of Rochester
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to