Search code examples
shellcurlargumentsinteractivehardcode

How do I interactively pass arguments to cURL from the shell?


I want to create an alias to get a file using cURL which prompts for the:

  • URL
  • output path
  • username and password of a proxy

How would I be able to do this interactively rather than hardcoding everything?


Solution

  • The following works as expected:

    alias proxyget='read userid?"Userid: "; read passwd?"Password: "; read url?"URL: "; read local?"Local: "; curl -x 1.2.3.4:8080 -U $userid:$passwd  $url -o $local;'
    

    References