日期:2014-05-16  浏览次数:20722 次

看看这个编程题目!!!!
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