#!/bin/csh -f #(ie run the cshell on this but don't read the .cshrc) # # version = 1.06 of mkold 2004 Jan 7 # 2004 Jan 7, 1.06: use -e instead of -f test for existance. # 1997 Jan 14, 1.05: functional # origin at least 1990 April 16 # this script creates an 'old' link to my trash pile. # a bug is that I can't get -L or -h to work in the # if statement (despite what it says in the manual) # the only untoward consequence seems to be that if one # tries to make a link twice, a funny self referential file # ~/misc/trash/trash will be made ... # the third time it yells that the link exists (which is ok) set trashfile = 'old' echo link name to create: $trashfile if (-e $trashfile) then # should use -L or -h but this # does NOT work, it says: # if: Badly formed number echo old directory link exists else echo $trashfile does not exist - make a new one pushd ~/ set m = misc set t = trash if !(-f $m) then if !(-d $m) then echo $m directory being created ... mkdir $m endif endif pushd $m if !(-f $t) then if !(-d $t) then echo $t directory being created ... mkdir $t endif endif popd popd echo making a link to ~/$m/$t ln -s ~/$m/$t $trashfile endif # set y=`ls -l $filename | awk '{print $4}'` # if !($y) echo $filename does not exist - make a new one # if ($y) echo old exists: # if ($y) ls -alF old # #if ($y) rm -f old # rm -f old # ln -s ~/misc/trash old # if ($y) echo new:; ls -alF old