文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>一個shell聽說有問題,,試試看

一個shell聽說有問題,,試試看

时间:2006-07-19  来源:snowtty

numargs=$#
filelist=
copylist=
while [ "$#" -gt 1 ]
do
        filelist="$filelist $1"
        shift
done
to="$1"
if [ "$numargs" -lt 2 -o "$numargs" -gt -2 -a !-d "$to" ]
then echo "usage wrong"
exit 1
fi
for from in $filelist
do
if [ -d "$to" ]
then tofile="$to/$(basename $from)"
else
tofile="$to"
fi
if [ -e "$tofile" ]
then
        echo "$tofile already exists overwrite?"
        read answer
        if [ $answer=yes ]
        then
        copylist="$copylist $from"
fi
else
copylist="$copylist $from"
fi
done
if [ -n "$copylist" ]
then
        cp $copylist $to
fi

运行错误检测   
$copp aa  #copp为文件名称
提示  mycp3[10]: [: argument expected
应该echo "usage wrong"然后退出阿  
另外 谁能解释一下exit 0 根exit 1 有什么区别呢 退出不同的层次么?
    仔细比较50次
!-d
! -d
相关阅读 更多 +
排行榜 更多 +
像素太空杀

像素太空杀

飞行射击 下载
忍者手势

忍者手势

飞行射击 下载
勇士X地下城大冒险

勇士X地下城大冒险

角色扮演 下载