首页 > 系统服务 > 详细

interActive wgetDownLoad shellScripts

时间:2014-12-07 20:15:16      阅读:255      评论:0      收藏:0      [点我收藏+]

#!/bin/bash

url=$1
dir=$2
download()
{
        cd $dir >> /dev/null 2>&1
        if [ $? -ne 0 ];then
                read -p "$dir No such file or directory,create?(y/n)" answer
                if [ "$answer" == "y" ];then
                        mkdir -p $dir
                        cd $dir
                        wget  $url 1> /dev/null 2>&1
                        if [ $? -ne 0 ]; then
                                return "52"
                        fi
                else
                        return "51"

                fi
        fi
}

download $url $dir
echo $?

interActive wgetDownLoad shellScripts

原文:http://www.cnblogs.com/ruiy/p/4149708.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!