Last active
February 8, 2017 09:17
-
-
Save stephan281094/8b82d00f2d0cb7169f05dad74e714ddd to your computer and use it in GitHub Desktop.
Make it easy to bulk replace symlink targets with a common pattern.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for sym in $(find $1 -type l); do | |
target=$(readlink $sym) | |
new=${target/$2/$3} | |
echo "Retargeting '$sym' to '$new'.." | |
rm $sym && ln -s $new $sym | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Retarget symlinks
Make it easy to bulk replace symlink targets with a common pattern.
Usage
How it works