Skip to content

Instantly share code, notes, and snippets.

@willscripted
Created February 8, 2015 13:53
Show Gist options
  • Save willscripted/76af815da5a65f32729b to your computer and use it in GitHub Desktop.
Save willscripted/76af815da5a65f32729b to your computer and use it in GitHub Desktop.
playing around with getopts
#!/usr/bin/env bash
OPTIND=1 # Reset getopts iterator
while getopts "ht:f:" opt; do
case "$opt" in
h|\?)
echo "h or nothing?"
exit 0
;;
t) to_format=$OPTARG
echo "set the to param to $OPTARG"
;;
f) from_format=$OPTARG
echo "set the from param to $OPTARG"
;;
esac
done
pandoc -t json -s < /dev/stdin | ./test.py
echo "ok, byebye"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment