Last active
December 18, 2015 07:09
-
-
Save iwillspeak/5744985 to your computer and use it in GitHub Desktop.
Open a file using iA Writer.app, for those who don't want to have to leave the command line to open markdown files.
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
#! /usr/bin/env bash | |
# Touch any files that don't exist | |
for file in "$@" | |
do | |
echo "$file" | |
if [ ! -a "$file" ]; then | |
touch "${file}" | |
fi | |
if [ ! -w "$file" ] || [ ! -r "$file" ]; then | |
echo "writer: error: ${file} can't be opened for reading and writing" >&2 | |
exit 1 | |
fi | |
done | |
# Pass it on to Writer.app | |
open -a "iA Writer" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment