Bash script for downloading files with Curl

后端 未结 4 1771
挽巷
挽巷 2021-01-13 15:47

I\'m trying to knock together a little batch script for downloading files, that takes a URL as its first parameter and a local filename as its second parameter. In testing

4条回答
  •  独厮守ぢ
    2021-01-13 16:29

    I agree with cms. Quoting the input arguments correctly is much better style - what will you do with the next problem character? The following is much better.

    curl -# -C - -o "$2" $1
    

    However, I hate people not answering the asked question, so here's an answer :-)

    #!/bin/bash
    clear
    echo Downloading $1
    echo
    filename=`echo $2 | sed -e "s/ /\\\ /g"`
    echo $filename
    echo eval curl -# -C - -o $filename $1
    

提交回复
热议问题