ChangeLink()
{
link_temp="./linktemp"
local SYSTEMTYPE=`uname`;
local old_link_home=${1};
local new_link_home=${2};
local old_link_home_new=`echo ${old_link_home} | sed 's/\//\\\\\//g' `
local new_link_home_new=`echo ${new_link_home} | sed 's/\//\\\\\//g' `
case ${SYSTEMTYPE} in
HP-UX|AIX) find . -type l -exec ls -al {} \; | grep ${old_link_home} | awk '{print $9 , $11}' > ${link_temp}
;;
Linux) find . -type l -exec ls -al {} \; | grep ${old_link_home} | awk '{print $8 , $10}' > ${link_temp}
;;
*) echo ""> ${link_temp}
;;
esac
#change file link
while read line
do
linkFile=`echo ${line} | awk '{print $1}'`
linkPath=`echo ${line} | awk '{print $2}' | sed -e "s/${old_link_home_new}/${new_link_home_new}/g"`
if [ "_" != "_${linkFile}" ]
then
rm ${linkFile}
ln -s ${linkPath} ${linkFile}
fi
done < ${link_temp}
}
ChangeLink $1 $2
{
link_temp="./linktemp"
local SYSTEMTYPE=`uname`;
local old_link_home=${1};
local new_link_home=${2};
local old_link_home_new=`echo ${old_link_home} | sed 's/\//\\\\\//g' `
local new_link_home_new=`echo ${new_link_home} | sed 's/\//\\\\\//g' `
case ${SYSTEMTYPE} in
HP-UX|AIX) find . -type l -exec ls -al {} \; | grep ${old_link_home} | awk '{print $9 , $11}' > ${link_temp}
;;
Linux) find . -type l -exec ls -al {} \; | grep ${old_link_home} | awk '{print $8 , $10}' > ${link_temp}
;;
*) echo ""> ${link_temp}
;;
esac
#change file link
while read line
do
linkFile=`echo ${line} | awk '{print $1}'`
linkPath=`echo ${line} | awk '{print $2}' | sed -e "s/${old_link_home_new}/${new_link_home_new}/g"`
if [ "_" != "_${linkFile}" ]
then
rm ${linkFile}
ln -s ${linkPath} ${linkFile}
fi
done < ${link_temp}
}
ChangeLink $1 $2