提示用户指定备份的目录的路径,若目录已存在则显示提示信息后跳过,否则显示相应的提示信息后创建该目录.
具体实现:
#!/bin/bash
read -p "what is your backup directory:" bakdir
if [ -d $bakdir ];then
echo "$bakdir already exist."
else
echo "$bakdir is not exist,will make it"
mkdir $bakdir
fi