Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wish there was a solution for something like

Download(file.gz)

and that gets converted to either a wget or curl based on what the system has.



    dl_tool=$(command -v curl || command -v wget)
    if [[ ${dl_tool} == *curl* ]]; then
      dl_cmd="${dl_tool} -sLO $1"
    elif [[ ${dl_tool} == *wget* ]]; then
      dl_cmd="${dl_tool} -q $1"
    else
      printf "%s\n" "ERROR: curl and wget not available, exiting"
    fi
Can easily be turned into a function.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: