Is there a way to refresh a symlink once it has changed or gone stale?
I have a script which points to a link say:
/apps/myapps/release/current/....
Where current is a symlink pointing to say the latest release
Later I try to use a this link in a manner like
apps/myapps/release/current/scripts/start.sh
But if I have this current
as working directory, changing the link won't change anything.
In order for this change to become effective, I would have to cd to apps/myapps/release and then back to scripts
in order to access start.sh
.
I am sure there must be a better way.
Maybe
cd `pwd`
would be perfect. Let me have a look:
cd /tmp
mkdir a
mkdir b
touch a/OLD
touch b/NEW
ln -snf a cur
cd cur
ls # shows OLD
ln -snf b /tmp/cur
ls # shows OLD
cd `pwd`
ls # shows NEW
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With