In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use shell to create a date catalog, which is very detailed and has a certain reference value. Friends who are interested must read it!
You need to create a subdirectory (named after the year) in multiple directories (such as beijing shanghai tianjin guangzhou, etc.), then go to the subdirectory, create a new directory, and name it after the date of the current day.
The end result is as follows:
The code is as follows:
China/guangdong/china/guangdong/shenzhen/2010/1206china/guangdong/shenzhen/2010/1207china/guangdong/shenzhen/baoan/2010/1206china/guangdong/shenzhen/baoan/2010/1207china/guangdong/shenzhen/baoan/guangming/2010/1206china/guangdong/shenzhen/baoan/guangming/2010/1207
My realization:
#! / bin/bash read-p "PLEASE input country:" cou read-p "PLEASE input city:" city read-p "PLEASE input name:" name#echo "$cou,$city,$name" date=$ (date +% Y) # echo $date date2=$ (date +% m% d) # echo $date2 if [- d ". / $cou/$city/$name/$date/$date2"] Then echo "the dir is exit" else mkdir-p. / $cou/$city/$name/$date/$date2 fi
Effect:
[root@localhost hbshell] # test.sh
PLEASE input country:china
PLEASE input city:hangzhou
PLEASE input name:hb
# [root@localhost hbshell] # ll china/hangzhou/hb/2011/0321/
Total 0
The above is all the contents of the article "how to create a date Catalog using shell". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.