Skip to content

Instantly share code, notes, and snippets.

Created June 30, 2021 23:39
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Tool that I find very helpful and use everyday, can't be that bad if it's just one line right?
# if not args then display notes
# this script does not seem safe to me, but if only I use it it's fine, definitly very explotiable though
echo "$(date -Iminutes)" "$@" >> "$notefile"
Copy link

neilco commented Jul 1, 2021

Brilliant! Here's my take on your script with the following changes:

  • Output the contents of the note file if no arguments are passed.

  • Updated hardcoded path to note file to use $HOME instead.

  • Updated date command to be more portable

    date under macOS doesn't have a -I option. A portable solution is to use +%FT%H:%M instead.



if [[ "$#"-eq 0 ]]; then
  cat $notefile
  echo "$(date +%FT%H:%M)" "$@" >> "$notefile"

Copy link

oidz1234 commented Jul 1, 2021

Thank you! I am now using your version :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment