Skip to content

Instantly share code, notes, and snippets.

@gusbicalho
Last active February 27, 2019 16:40
Show Gist options
  • Save gusbicalho/9faf89149ad9683884f62c475c185b26 to your computer and use it in GitHub Desktop.
Save gusbicalho/9faf89149ad9683884f62c475c185b26 to your computer and use it in GitHub Desktop.
literate bash
#! /usr/bin/env bash
cat test.md | awk 'BEGIN { inBash = 0 } $0 == "```" { inBash = 0 } inBash { print $0 } $0 == "```bash" { inBash = "true" }' | bash
# sample use: cat test.md | ./litbash.sh

Asdf

Hue, this is not real

function sayit() {
  echo 'this is bash'
}

This isnt real, either.

sayit

Yay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment