Path: utzoo!attcan!uunet!cs.utexas.edu!usc!ucsd!ucbvax!MCIRPS2.MED.NYU.EDU!root From: root@MCIRPS2.MED.NYU.EDU Newsgroups: comp.sys.sgi Subject: Symbolic Links for Lunks. Message-ID: <9008072310.AA21830@mcirps2.med.nyu.edu> Date: 7 Aug 90 21:12:17 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: karron%CMCL2.NYU.EDU@cunyvm.cuny.edu Organization: The Internet Lines: 92 X-Unparsable-Date: Tue, 7 Aug 90 16:10:54 DSD After having clobbered too many very important files and directories that I wanted to make local symlinks to, I wrote the script below to make it more difficult for me to clobber my files with sgi symbolic links. Use it in good health. I would be interested in your improvements too! #! /bin/sh # Less dangerious and more user frendly front end for ln -s . # Prevents you from making symbolic linkages the wrong way and clobbering what # you want to link to. clear # . Version.mac #a macro that records who and how often this is used. file="$1" echo "Enter existing file you wish create a link to" if [ "$1" ] then echo "or enter a return to use $1" fi read file if [ -z "$file" ] then file=$1 fi if [ -x $file ] then echo "GOOD. $file exists" ls -ld $file else echo "$file does not exist" echo " How do you expect me to make a link to a file I can't find." echo " bad bad boy" exit 1 fi echo "\n\n" echo "Enter name of link to create $2" if [ -z "$2" ] then echo "or return to use `basename $file`" fi read link if [ -z "$link" ] then link=$2 fi if [ -z "$link" ] then link=`basename $file` echo "do you want me to use $link as your local link to \n$file ?" echo "\nReturn to continue,anything else aborts." read ans if [ -n "$ans" ] then exit 1 fi fi if [ -x $link ] then echo "bad bad bad boy, $link exists. If you don't believe me, look" ls -ld $link exit 1 else echo "nice kitty" echo " $link is ready to create" fi ln -s $file $link echo "\n\n" ls -ld $file $link | cut -c1-10,40- echo "$0 :Completed" # . End.mac exit 0 +-----------------------------------------------------------------------------+ | karron@nyu.edu Dan Karron | | . . . . . . . . . . . . . . New York University Medical Center | | 560 First Avenue \ \ Pager <1> (212) 397 9330 | | New York, New York 10016 \**\ <2> 10896 <3> | | (212) 340 5210 \**\__________________________________________ | +-----------------------------------------------------------------------------+