在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
今天看到一个shell题目,正好拿来练练手 复制代码 代码如下: china/guangdong/ china/guangdong/shenzhen/2010/1206 china/guangdong/shenzhen/2010/1207 china/guangdong/shenzhen/baoan/2010/1206 china/guangdong/shenzhen/baoan/2010/1207 china/guangdong/shenzhen/baoan/guangming/2010/1206 china/guangdong/shenzhen/baoan/guangming/2010/1207 我的实现: #!/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 效果: |
请发表评论