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

James P. Kinney III jkinney at localnetsolutions.com
Tue Aug 21 15:32:49 EDT 2007


On Tue, 2007-08-21 at 15:32 -0400, Jim Lynch wrote:

> Thanks, guys, a combination of readlink and Jim's script did what I want.
> 
I learned about readlink today!

> For the record:
> 
> #!/bin/bash
> ls -l current
> readlink -f current| grep db2
> if [ $? == 0 ]
> then
> echo  is db2
> rm current && ln -sf db1 current
> else
> echo is db1
> rm current && ln -sf db2 current
> fi
> ls -l current
> 
> Jim.
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
> 
-- 
James P. Kinney III          
CEO & Director of Engineering 
Local Net Solutions,LLC        
770-493-8244                    
http://www.localnetsolutions.com

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<jkinney at localnetsolutions.com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part




More information about the Ale mailing list