Batch update script soft connection

There is a scene for the soft path connected to update the target, but the soft one is connected to a larger problem number two, the second is the path format is operated under the following directory A B C directory below directory, so write the script for batch operations :

#! / bin / the bash
Source / etc / Profile
#DATA_PATH = "/ Data / Share / 6666 / WWW"
Data_Path = "/ Data / POOL1 / 888888"
CD $ Data_Path
DIR_NAME = "0. 1 ABCDEFGHIJKLMNOPQRSTU VWXYZ 2. 5. 4. 3. 6. 7 . 9. 8 "
for DIR_NAME DIR1 in $ {}; do
#echo Data_Path} {$ / $ DIR1
Test Data_Path -d $ {} / $ DIR1
IF [-eq $ 0?]; the then
CD Data_Path} {$ / $ DIR1
echo "The first stage cycles directory:", pwd
for Data_Path DIR2 in $ {} / DIR1} {$ /} $ {DIR_NAME; do
Test Data_Path -d $ {} / $ DIR1 / DIR2} {$
IF [-eq $ 0? ]; the then
CD Data_Path} {$ / $ DIR1 / DIR2} {$
echo "second stage cycles directory:", pwd
for NAME in /bin/ls -l ${DATA_PATH}/${DIR1}/${DIR2}; do
IF [-L Data_Path} {$ /} $ {DIR1 / DIR2} {$ / NAME} {$]; the then
echo "directory access to the second level domain name --->$NAME"
Data_Path link_name in $ {for} / {$} DIR1 / DIR2} {$ / $ {NAME}; do
IF [link_name -L $ {}]; the then
CD Data_Path} {$ /} $ {DIR1 / DIR2 $ {}
echo "header source link path:, $ link_name"
echo "current absolute path, pwd"
S_NAME1 = ls -l ${LINK_NAME} | awk '{print $9}'
echo "source link domain:, $ {} S_NAME1"
################## ##########################################
D_NAME = ls -l ${LINK_NAME} | awk -F "/data/share/www/" '{print $2}'
echo "the purpose of link path: , ../../${D_NAME} "
###################################### ######################
RM -rf $ {} S_NAME1
LN -sv ../../${D_NAME S_NAME1} {} $
echo -e " The current domain name processing is complete, ready to wrap, \ the n-"
fi
the Shift
DONE
the Shift
fi
the Shift
DONE
fi
the Shift
DONE
fi
the Shift
DONE

Guess you like

Origin blog.51cto.com/14322562/2442693