Hacker News new | ask | show | jobs
by ghawk1ns 1566 days ago
You can try with a function to simplify the cli:

$ rip() { curl -G -H 'Accept: text/plain' --url https://dontbeevil.rip/search --data-urlencode 'q=$@'}

$ rip heartbleed bug

1 comments

The single quotes probably need to be double ones in the last argument to permit parameter expansion, and the $@ (separately quote every argument if quoted) probably wants to be a $* (quote the entire space-separated argument array if quoted)? There’s also the grammar quirk where the last command inside braces (but not parens) needs a semicolon or newline to separate it from the brace itself. Thus:

  rip() { curl -G -H 'Accept: text/plain' --url https://dontbeevil.rip/search --data-urlencode "q=$*"; }
(tested).

I still support the point that there is no reason for this to be a (grammar-defying) alias rather than a (tame) shell function or even a separate script.