[Surfraw-devel] How to use surfraw with curl

Rowan Thorpe rowan at rowanthorpe.com
Wed Aug 10 13:00:29 UTC 2016


(am replying to the digest mailing-list through webmail, this probably
won't thread properly with the message it is replying too..)

On 9 August 2016 at 11:21:29, David Niklas <doark at mail.com> wrote:
> Hello,
> I entered this (as a test):
> % sr -browser="curl -L " -s duckduckgo trump
> ---8<---
> Now, I expected to get results as an html page
> to stdout.
> What do I do?

After a few quick experiments with things like -browser="echo x",
-browser="printf 'x%sx'", etc I can see that the commandline parser in
sr obviously just takes the first non-whitespace characters given to
-browser and discards the rest, so your use of -browser="curl -L" was
seen as -browser=curl (hence how it didn't follow the redirect which
the -L would have caused if it was present in the final invocation,
and how adding verbose flags made no difference).

The easiest workaround is to create a small shell wrapper-script with
the desired flags, and call that from sr.
-- 
Rowan Thorpe
http://twitter.com/rowanthorpe
http://www.rowanthorpe.com
PGP fingerprint:
 BB0A 0787 C0EE BDD8 7F97  3D30 49F2 13A5 265D CCBD
----
"A riot is the language of the unheard." - Dr. Martin Luther King
"There is a great difference between worry and concern. A
worried person sees a problem, and a concerned person solves a
problem." - Harold Stephens
"Ignorance requires no apologies when it presents questions
rather than assertions." - Michael Sierchio (OpenSSL mailing list)
"What we need more than an end to wars is an end to the
beginning of all wars." - Franklin Roosevelt



More information about the Surfraw-devel mailing list