Skip to content

Instantly share code, notes, and snippets.

@iwillspeak
Last active December 18, 2015 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwillspeak/5744985 to your computer and use it in GitHub Desktop.
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.
#! /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