Skip to content

Instantly share code, notes, and snippets.

@dbbrian
Created November 25, 2015 16:06
Show Gist options
  • Save dbbrian/27c94c321843e8856941 to your computer and use it in GitHub Desktop.
Save dbbrian/27c94c321843e8856941 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# [Create and] open a file in Byword from bash
#
# Usage:
#
# $ byword a-file
#
# Exit if a directory is passed
if [[ -d "$1" ]]; then
>&2 echo "\"$1\" is a directory. Try with a file instead!" ; exit 1
fi
# Create the file if necessary
if [[ ! -f "$1" ]]; then
touch "$1"
fi
open -a Byword "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment