首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

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

2012-02-27 
看看这个编程题目!!!!Writeashellscripttochecktheitemsofadesignateddirectorywhichmustbeinputfromyourt

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

热点排行