Skip to content

Instantly share code, notes, and snippets.

@dash1291
Last active December 9, 2017 14:22
Show Gist options
  • Save dash1291/d6c74612c048ee66438c7c0f72dd28dd to your computer and use it in GitHub Desktop.
Save dash1291/d6c74612c048ee66438c7c0f72dd28dd to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -d "$NOTES_DIRECTORY" ]; then
filesuffix=`date "+%Y-%m-%d-%H-%M-%S"`
filename="note-$filesuffix.txt"
filepath="$NOTES_DIRECTORY"/$filename
if [ ! -z "$1" ]; then
echo "Saving note to $filepath"
echo "$1" > "$filepath"
else
echo "Opening editor to edit $filepath"
$EDITOR "$filepath"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment