1450833603#!/bin/bash
D="/home/ss/ss"
if [ ! -d $D ];then
echo "The directory does exist"
echo -n "create it now [y/n]"
read ANS
if [ "$ANS" = "y" ] || [ "$ANS" = "Y" ];then
echo "creating now"
mkdir -p $D >/dev/null 2>&1
if [ $? -ne 0 ];then
echo "Errors creating the directory"
exit 1
fi
fi
fi
D="/home/ss/ss"
if [ ! -d $D ];then
echo "The directory does exist"
echo -n "create it now [y/n]"
read ANS
if [ "$ANS" = "y" ] || [ "$ANS" = "Y" ];then
echo "creating now"
mkdir -p $D >/dev/null 2>&1
if [ $? -ne 0 ];then
echo "Errors creating the directory"
exit 1
fi
fi
fi
本文转自 luoguo 51CTO博客,原文链接:http://blog.51cto.com/luoguoling/959781