From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtprelay02.ispgateway.de ([80.67.29.24]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1S7BLv-0004iW-Od for ptxdist@pengutronix.de; Mon, 12 Mar 2012 20:56:38 +0100 Received: from [78.47.165.117] (helo=regiomontanus.bwalle.de) by smtprelay02.ispgateway.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1S7BLv-0004tR-9U for ptxdist@pengutronix.de; Mon, 12 Mar 2012 20:56:19 +0100 Date: Mon, 12 Mar 2012 20:56:17 +0100 From: Bernhard Walle Message-ID: <20120312195617.GA13907@regiomontanus.bwalle.de> References: <1329252947-118-1-git-send-email-bernhard@bwalle.de> <20120214220510.GQ25569@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120214220510.GQ25569@pengutronix.de> Subject: Re: [ptxdist] [PATCH] ptxdist: Check for GNU readlink Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de Hi Michael, thanks again for the review. * Michael Olbrich [2012-02-14 23:05]: > > +# bash implementation of realpath / readlink -f > > +# arg1 - filename > > +realpath() > > +{ > > + local fname oldfname > > + > > hmmm, scary. What's wrong about 'local'? > Another idea: Is the problem that "readlink -f" does not work or does > "readlink" not exist at all? Any readlink implementations should work here > for fname="$(readlink "${fname}")". You're right. Even Apple adds a working readlink implementation. :) > > + if [ "$fname" = . ] ; then > > + fname="$(dirname $oldfname)" > > + elif echo $fname | grep -vq '^/' - ; then > > elif [ "${fname}" -eq "${fname#/}" ]; then -eq is only for numeric comparison, so it should be '=', right? > ( cd "$(dirname "${fname}")" > > > + fname=$(pwd -P)/$(basename $fname) > > ) Assigning a variable in a subshell has no effect on the outer shell, has it? But echo'ing directly here works. A reworked version will follow. Regards, Bernhard -- ptxdist mailing list ptxdist@pengutronix.de