作者:手机用户2502920117 | 来源:互联网 | 2023-01-19 12:33
脚本如下:currenttime$(date+%Y%m%d%H%M%S);echocurrenttime$currenttime;currentyear$(date+
脚本如下:
currenttime=$(date +%Y%m%d%H%M%S);
echo "current time $currenttime";
currentyear=$(date +%Y);
echo "current year:$currentyear";
currentmOnth=$(date +%m);
echo "current month:$currentmonth";
currentday=$(date +%d);
echo "current day:$currentday";
hostname=`hostname`;
echo "this is hostname:$hostname";
path= "/cloud/log/$currentyear/$currentmonth/$currentday"
if [ -d "/cloud/log/$currentyear/$currentmonth/$currentday/" ];then
echo "the dir[/cloud/log/$currentyear/$currentmonth/$currentday/ ] is exit"
else
mkdir -p /cloud/log/$currentyear/$currentmonth/$currentday/
fi