#!/bin/bash
if [ -e $1 ]
then
echo "目录存在"
else
{
echo "目录不存在,是否创建1是2否"
read -p "请输入1或者2:" mulu
if [ $mulu -eq 1 ]
then
mkdir $1
elif [ $mulu -eq 2 ]
then
exit 0
fi
}
fi命令 目录地址
本文出自 “Tommy Lin” 博客,请务必保留此出处http://linyingyong.blog.51cto.com/6609544/1794612
shell基础之利用shell检测目录是否存在,不存在提示让用户创建目录
原文地址:http://linyingyong.blog.51cto.com/6609544/1794612