Created
February 13, 2017 17:49
-
-
Save coldpour/727fb2d1ef9932ba09e6c9c34c30527b to your computer and use it in GitHub Desktop.
move symlinks from one user to another
This file contains hidden or 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
| repairLinks() { for l in `ls -la | grep '\->' | grep "${1}" | awk '{print $9 "->" $11}'`; do t=`echo ${l%->*}`; o=`echo ${l#*->}`; s=`echo $o | sed "s/${1}/${2}/"`; echo "moving link ${t} from ${o} to ${s}"; rm -f $t; ln -s $s $t; done } | |
| # example usage | |
| # ------------- | |
| # repairLinks mholm holmi09 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment