Skip to content

Using CGI and BOS

It’s pointless to create a completely new concept of web in bash while there are other well-known implementations, for example Bash On Steroids

Fiction supports CGI scripts and includes fiction.serveCGI function for CGI routes

  1. Download Bash On Steroids and example index

    Terminal window
    wget https://raw.githubusercontent.com/tinoschroeter/bash_on_steroids/master/build.sh
    wget https://raw.githubusercontent.com/tinoschroeter/bash_on_steroids/master/index.htsh
  2. Run the builder

    Terminal window
    bash build.sh

    This should create an index.cgi file in /usr/lib/cgi-bin

  3. Add CGI route

    Open your main file (index.shx by default) and add simple HTML route:

    index.shx
    fiction.serveCGI "/usr/lib/cgi-bin/index.cgi" "/cgi" "text/html"
  4. Start the server

    Terminal window
    fiction run
  5. Verify that it works Open your server’s URL in the browser and add /cgi to open CGI route

It’s pretty straightforward, make your script executable

Terminal window
chmod +x /path/to/script

and add route:

index.shx
FictionServeCGI "/path/to/script" "/cgi" "text/html"

For all CGI features visit FictionServeCGI