SHELL基本命令备忘

1. 判断当前用户
if [ "$UID" -eq “0” ]
then
  echo "You are root."
else
  echo "You are just an ordinary user (but mom loves you as the same)."
fi

2. 时间戳
date +%Y%m%d%H%M%S 当前时间
date -d "5 day" +%Y%m%d%H%M%S 5天后的时间
date -d "5 days ago" +%Y%m%d%H%M%S 5天前的时间

猜你喜欢

转载自leovlys.iteye.com/blog/2183328