In article <98isma$1vp2$1@soapbox.cs.bham.ac.uk>,
ug55aes@cs.bham.ac.uk writes:
> On 12 Mar 2001 kers@hplb.hpl.hp.com wrote:
>> would
>>
>> ls -l the-linked-filename | sed -e 's/.*-> //'
>>
>> be any use?
>
> I don't speak sed, but wouldn't that just check that it was a symbolic
> link? If so, you can do that with the bash -L test
> (as in `[ -L foo ] && echo foo is a symlink`).
The output from the command is the filename at the far end of the link,
if it *is* a link, and the full ls line otherwise. So you could do
something like
if ($whatever == `the-above-command`) ...
[The sed command substitutes everything (.*) up to the ->space with nowt,
or (if that doesn't match) does nowt itself. So either you get the full
line, or the thing after the ->space, which is the target filename.]
I feel embarrased to admit I know things like this ...
--
Chris "deep in the bowels" Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html
|