Skip to content

Instantly share code, notes, and snippets.

@NorikDavtian
Created October 2, 2017 21:06
Show Gist options
  • Save NorikDavtian/e465e7e8df194d43d0a14c7964acf262 to your computer and use it in GitHub Desktop.
Save NorikDavtian/e465e7e8df194d43d0a14c7964acf262 to your computer and use it in GitHub Desktop.
# add this function to your bash profile, in my case ~/.zshrc
# FROM: https://dev.to/ricardomol/note-taking-from-the-command-line-156
# Examples:
#
# notes <<NOTE
# This is a very long note
# because sometimes I like
# to write explanations of
# my commands and such.
# NOTE
#
# Example 2:
# notes my_command -which -I -want -to remember
notes() {
if [ ! -z "$1" ]; then
# Using the "$@" here will take all parameters passed into
# this function so we can place everything into our file.
echo "$@" >> "$HOME/notes.md"
else
# If no arguments were passed we will take stdin and place
# it into our notes instead.
cat - >> "$HOME/notes.md"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment