In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you linux how to achieve batch update soft connection script, I hope you will learn something after reading this article, let's discuss it together!
In the scenario, the soft connection with a path needs to update the target, but there are two problems with the soft connection: one is that the number is relatively large, and the other is that the path format is to operate under directory B under directory An and directory C under directory A, so write scripts to operate in batches:
#! / bin/bash
Source / etc/profile
# DATA_PATH= "/ data/share/6666/www"
DATA_PATH= "/ data/pool1/888888"
Cd $DATA_PATH
DIR_NAME= "a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9"
For DIR1 in ${DIR_NAME}; do
# echo ${DATA_PATH} / $DIR1
Test-d ${DATA_PATH} / $DIR1
If [$?-eq 0]; then
Cd ${DATA_PATH} / $DIR1
Echo "first level Loop Directory:", pwd
For DIR2 in ${DATA_PATH} / ${DIR1} / ${DIR_NAME}; do
Test-d ${DATA_PATH} / $DIR1/$ {DIR2}
If [$?-eq 0]; then
Cd ${DATA_PATH} / $DIR1/$ {DIR2}
Echo "second level Loop Directory:", pwd
For NAME in/ bin/ls-l ${DATA_PATH} / ${DIR1} / ${DIR2}; do
If [- L ${DATA_PATH} / ${DIR1} / ${DIR2} / ${NAME}]; then
Domain name obtained by echo "second level directory->, $NAME"
For LINK_NAME in ${DATA_PATH} / ${DIR1} / ${DIR2} / ${NAME}; do
If [- L ${LINK_NAME}]; then
Cd ${DATA_PATH} / ${DIR1} / ${DIR2}
Echo "Domain name Source Link path:, $LINK_NAME"
Echo "current absolute path, pwd"
S_NAME1=ls-l ${LINK_NAME} | awk'{print $9}'
Echo "Source Link Domain name:, ${S_NAME1}"
# # #
D_NAME=ls-l ${LINK_NAME} | awk-F "/ data/share/www/"'{print $2}'
Echo "destination link path:,. /.. / ${D_NAME}"
# # #
Rm-rf ${S_NAME1}
Ln-sv. /.. / ${D_NAME} ${S_NAME1}
Echo-e "current domain name processing completed, ready to wrap,\ n"
Fi
Shift
Done
Shift
Fi
Shift
Done
Fi
Shift
Done
Fi
Shift
Done
After reading this article, I believe you have a certain understanding of "linux how to achieve batch update soft connection script". If you want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.