Created
November 25, 2015 16:06
-
-
Save dbbrian/27c94c321843e8856941 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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