阿牛 发表于 2018-8-20 06:07:53

第三个shell (if …then )

#/bin/sh  if [ -f /root/test/logical ] ; then
  echo " 这是一个文件,删除后,用touch 建立一个新文件!"
  touch /root/test/logical
  elif [ -d /root/test/logical ] ; then
  echo " 这是一个目录,将其删除!"
  rm -Rf /root/test/logical
  else
  echo " 不存在,用touch 建立一个新文件"
  touch /root/test/logical
  fi

页: [1]
查看完整版本: 第三个shell (if …then )