I think what you want is to combine net/http (for the server part) with
os/exec (to invoke bash, though with your example you don't need a shell
and could execute the `ls` command directly). You'd need one or two
handlers; maybe browse this to understand more:
It's not specifically what you were asking, but this might be something
that could be done without Go at all, by emulating a full Linux system
entirely in the browser. For example: https://bellard.org/jslinux/
On Wed, Feb 14, 2018 at 6:56 PM, David Brendlinger <
> can someone create an example for me of a webpage that can run a bash
> command ?
> I would like a index.html that has a button on it. you hit the button and
> it would do a ls /tmp >> myfile
> I am a newby :)
> Thank you in advance
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Jonathan Yu / *@jawnsy* on LinkedIn <https://linkedin.com/in/jawnsy>,
Twitter <https://twitter.com/jawnsy>, GitHub <https://github.com/jawnsy>,
*“Ever tried. Ever failed. No matter. Try again. Fail again. Fail better.”* —
Samuel Beckett, Worstward Ho (1983)
“In an adaptive environment, winning comes from adapting to change by
continuously experimenting and identifying new options more quickly and
economically than others. The classical strategist's mantra of sustainable
competitive advantage becomes one of serial temporary advantage.” — Navigating
the Dozens of Different Strategy Options
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.