Skip to content

Instantly share code, notes, and snippets.

@schuchard
Created August 1, 2018 02:25
Show Gist options
  • Save schuchard/51cafd491aa47a136a82f48d933e9175 to your computer and use it in GitHub Desktop.
Save schuchard/51cafd491aa47a136a82f48d933e9175 to your computer and use it in GitHub Desktop.
CLI for bash scripts
#!/usr/bin/env bash
# run `sh run.sh` for options
# run `sh run.sh hello`
volt() {
printf "\xE2\x9A\xA1";
}
run_hello() {
echo "\n<<< hello world >>>\n";
}
print_usage() {
echo "
COMMANDS:\n
$(volt) hello | hello world"
}
case "$1" in
hello) run_hello ;;
*) print_usage ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment