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

Jim Lynch ale_nospam at fayettedigital.com
Tue Aug 21 11:01:57 EDT 2007


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.

Something like

db1
db2
current -> db1

Then some sort of an if test that says

if current is linked to db1
    ln -sf db2 current
else
   ln -sf db1 current
fi

Any suggestions?

Thanks,
Jim.



More information about the Ale mailing list