Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to reduce the keystrokes when I use curl to test web services on my workstation.

Is there a way to set a default hostname of 'localhost:3000' into ~/.curlrc so the following will work?

curl /foo.json
share|improve this question
add comment

1 Answer

On Unix – shell functions:

cu() { curl "http://localhost:3000/$1"; }

cu foo.json would be translated to curl http://localhost:3000/foo.json.

Downside: needs far more code to support options (curl -I and stuff), but that can be achieved too.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.