In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.