This Website is Built with Bash
The
Bash Shell
has been compiled to
wasm
with
emscripten
. A small JavaScript library is then used to "load" the bash scripts and run them. To see more information check the links below or view the source code of this page.
Example Script
echo "Hello from bash!" echo "Bash Version: $BASH_VERSION" echo "Compiled for: $MACHTYPE" echo echo "My PID is $$, my PWD is $PWD" echo echo "You won't see this" > /dev/null echo -n "I can count:" for i in {1..3}; do echo -n " $i" done echo if [[ $MACHTYPE == *emscripten* ]]; then echo "Hello Web!" fi echo "getrandom: RANDOM=$RANDOM SRANDOM=$SRANDOM" # uncomment these commands to see all variables # set or all builtins (respectively) # set # compgen -b # there is also a "web" builtin added to this build that # can modify the dom # web dom.write '#footer' "hello $$" # web document.title "new web browser title"
Run
stdout
stderr
if you can read this something broke :(
Source Code
https://github.com/bahamas10/bash-wasm
Video Explanation
See how this project was created here:
https://www.youtube.com/watch?v=TEq-6AqMFBI
Pages built during the video
Known Limitations
No fork/exec/wait - this means no pipes :(. This is due to limitations with emscripten and JavaScript only operating on a single thread.
Unimplemented syscall errors emitted to stderr - yeah those just happen i guess lol