[ale] Does anyone have a definitive way of determining the target of a soft link in bash?

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Aug 21 11:09:35 EDT 2007


On Tue 2007-08-21 11:01:57 -0400, Jim Lynch wrote:

> I want to flip flop two directories by pointing a soft link to one and 
> then the other the next day.  I'm trying to come up with the best way to 
> tell which of the directories is linked so I can replace the link with 
> the other one.

i'd use 

  readlink -f current

and test against the output.  If you're controlling all possible
values that it could be linked to, you might prefer to omit the -f.

hth,

       --dkg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 826 bytes
Desc: not available




More information about the Ale mailing list