From: Mark Wooding Date: Wed, 22 Jun 2011 08:13:29 +0000 (+0100) Subject: rcheck: Hunt down directory by chasing symlinks. X-Git-Url: https://git.distorted.org.uk/~mdw/rcheck/commitdiff_plain/0c159fe7698d0a510b649e645c1c5e680eee37e6 rcheck: Hunt down directory by chasing symlinks. Better than hardwiring it. --- diff --git a/rcheck b/rcheck index 84e7c51..cd40440 100755 --- a/rcheck +++ b/rcheck @@ -3,7 +3,14 @@ ### Run everyday health checks on remote systems. set -e -cd /usr/local/share/rcheck +prog=$0 +while + case "$prog" in */*) ;; *) prog=./$prog ;; esac + cd "${prog%/*}" + [ -L "${prog##*/}" ] +do + prog=$(readlink "${prog##*/}") +done for host in "$@"; do