读书人

看看这个编程题目!解决方案

发布时间: 2012-02-27 10:00:22 作者: rapoo

看看这个编程题目!!!!
Write a shell script to check the items of a designated directory which must be input from your terminal: if the item is a directory, delete it; else print the name of this item.

[解决办法]
#!/bin/sh
echo "read directory name: "
read Ddir
if [ -d $Ddir ]; then
echo "${Ddir} is exists "
if [ -w $Ddir ]; then
rm -rf $Ddir
echo "Remove completed! "
else
echo "You don 't have the permission to remove it! "
fi

else
echo "The directory ${Ddir} is not exists! "
fi

读书人网 >UNIXLINUX

热点推荐