[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: equivalent of Linux readlink -f in pure bash?
From: |
Jon Seymour |
Subject: |
Re: equivalent of Linux readlink -f in pure bash? |
Date: |
Tue, 9 Aug 2011 14:41:44 +1000 |
On Tue, Aug 9, 2011 at 2:36 PM, Jon Seymour <jon.seymour@gmail.com> wrote:
> On Tue, Aug 9, 2011 at 2:14 PM, Bob Proulx <bob@proulx.com> wrote:
>> Jon Seymour wrote:
>>> I always use sed for this purpose, so:
>>>
>>> $(cd "$dir"; ls -l "$base" | sed "s/.*->//")
>>>
>>> But, with pathological linking structures, this isn't quite enough -
>>> particularly if the target of the link itself contains paths, some of
>>> which may contain links :-)
>>
>> Agreed! Symlinks with arbitrary data, such as holding small shopping
>> lists in the target value, are so much fun. I am more concerned that
>> arbitrary data such as "->" might exist in there more so than
>> whitespace. That is why I usually don't use a pattern expression.
>> But I agree it is another way to go. But it is easier to say
>> whitespace is bad in filenames than to say whitespace is bad and oh
>> yes you can't have "->" in there either. :-)
>>
>
> Ok, I think this does it...
>
> readlink_f()
> {
> ...
> }
And I make no claims whatsoever about whether this is vulnerable to
infinite recursion!
jon.
- equivalent of Linux readlink -f in pure bash?, Jon Seymour, 2011/08/08
- Re: equivalent of Linux readlink -f in pure bash?, Bob Proulx, 2011/08/08
- Re: equivalent of Linux readlink -f in pure bash?, Jon Seymour, 2011/08/08
- Re: equivalent of Linux readlink -f in pure bash?, Bob Proulx, 2011/08/08
- Re: equivalent of Linux readlink -f in pure bash?, Jon Seymour, 2011/08/09
- Re: equivalent of Linux readlink -f in pure bash?, Bob Proulx, 2011/08/09
- Re: equivalent of Linux readlink -f in pure bash?, Jon Seymour, 2011/08/09
- Re: equivalent of Linux readlink -f in pure bash?,
Jon Seymour <=
- Re: equivalent of Linux readlink -f in pure bash?, Bob Proulx, 2011/08/09
- Re: equivalent of Linux readlink -f in pure bash?, Jon Seymour, 2011/08/09
- Re: equivalent of Linux readlink -f in pure bash?, Andreas Schwab, 2011/08/09
Re: equivalent of Linux readlink -f in pure bash?, Bernd Eggink, 2011/08/09
Re: equivalent of Linux readlink -f in pure bash?, Jon Seymour, 2011/08/09
Message not available