[elinks-users] Run external command and display result as HTML

Witold Filipczyk witekfl at poczta.onet.pl
Thu Jul 26 12:07:52 PDT 2007

On Sun, Jul 22, 2007 at 08:10:22PM -0600, Kelly Jones wrote:
> How do I get elinks to run an external (Unix) command and display the
> result as HTML?
> If I type "Goto" "/bin/ls", the choices I get are "Open", "Save",
> "Display", and "Cancel". "Run" isn't one of the options.
> I realize "/bin/ls" doesn't output HTML-- it was just an example.
> I tried "Goto" "run:/bin/ls", but got back:
> This URL contains a protocol not yet known by ELinks.
> You can configure an external handler for it through
> the options system.
> How would I do this? Using the 'user:' protocol w/ lua somehow?

1) Compile ELinks with --enable-cgi
2) Enable CGI and set CGI path, for example add ~/bin there.
3) Save this script as 'run' in that path:
header('Content-Type: text/plain');
header('Cache-Control: no-cache');
$a = getenv("QUERY_STRING");
$r = rawurldecode($a);
3a) chmod +x ~/bin/run
text/html is left as an exercise for the reader.

4) Define the smart prefix run = file:///home/ziutek/bin/run?%s
Instead of ziutek insert your login off course.
5) Type in the ELinks Goto-URL dialog: run ls, etc.

You were warn, it is not 100% safe.

More information about the elinks-users mailing list