#!/bin/csh -f #(ie run the cshell on this but don't read the .cshrc) # version = 1.07 of here 2011 Sep 04 # 2011 Sep 04, 1.07: update documentation # 2009 Feb 09, 1.06: pwd -P for Mac OSX; gives actual path; SunOS ignores it. # 2007 Jul 18, 1.05: n fur; here gives feg, a directory lower! # 2007 Jul 08, 1.04: quotes on pwd to protect on Macs # 2005 Oct 16, 1.03: allow spaces in pwd # 2004 Jul 23, 1.02: improve documentation # 2002 Dec 9, 1.01: simple list of pointer names if any argument # 2000 Jul 19.05:14:13 origin # here # what are the pointers to the current directory? # documentation: # http://www.lecb.ncifcrf.gov/~toms/nowhere.html # Dr. Thomas D. Schneider # National Institutes of Health # National Cancer Institute # Center for Cancer Research Nanobiology Program # Molecular Information Theory Group # Frederick, Maryland 21702-1201 # toms@ncifcrf.gov # permanent email: toms@alum.mit.edu (use only if first address fails) # http://www.ccrnp.ncifcrf.gov/~toms/ set pwd = "`pwd -P`" # echo $pwd if ($#argv > 0) then # simple list # at the first 'cat' we have the long form of the pointers # lrwxrwxrwx 1 toms delila 8 Dec 9 13:31 test -> /tmp/k/a # Then break out the link names. ls -l ~/now |\ grep "$pwd" |\ sed -e "s/ / /g" |\ sed -e "s/ / /g" |\ sed -e "s/ / /g" |\ cat |\ sed -e "s/ /@#/8" |\ sed -e "s/ /#@/8" |\ tr "#" "\012" |\ grep -v @ |\ cat else echo "usage: here [any argument]" echo "find all 'nowhere' pointers to the current directory" # echo "(NB: second argument is broken under Mac OS X)" # grep $pwd `ls -alF ~/now` # gives # Too many words from `` #echo "$pwd" # ls -l ~/now/*fur* #echo --- # Tack "END-OF-LINE" to the end of the line to prevent finding the # pointers to directories under this one. ls -l ~/now |\ sed 's/$/END-OF-LINE/' |\ grep "${pwd}END-OF-LINE" |\ sed 's/END-OF-LINE//' |\ sed -e "s/ / /g" |\ sed -e "s/ / /g" |\ sed -e "s/ / /g" |\ cat exit ls -l ~/now |\ grep "$pwd" |\ sed -e "s/ / /g" |\ sed -e "s/ / /g" |\ sed -e "s/ / /g" |\ cat endif