bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: equivalent of Linux readlink -f in pure bash?


From: Bernd Eggink
Subject: Re: equivalent of Linux readlink -f in pure bash?
Date: Thu, 11 Aug 2011 20:55:30 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20110714 Thunderbird/5.0

On 09.08.2011 16:54, Stephane CHAZELAS wrote:
2011-08-09, 09:50(-04), Steven W. Orr:
[...]
*) To remove the trailing slashes, instead of

              while [[ $file == */ ]]
              do
                  file=${file%/}
              done

              file=${file##*/}    # file name

just say
            file="${file%${file##*[!/]}}"
[...]

            file=${file%"${file##*[!/]}"}

Same problem with "/" being changed to "" though.

This has been fixed. Also getlink() now outputs paths always in normalized form. Any feedback appreciated!

Bernd

--
http://sudrala.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]