-
-
Save alexjj/dd9764efa60983ec9f35 to your computer and use it in GitHub Desktop.
Keep a note
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
# Note | |
note () { | |
# if file doesn't exist, create it | |
if [[ ! -f $HOME/.notes ]]; then | |
touch "$HOME/.notes" | |
fi | |
if ! (($#)); then | |
# no arguments, print file | |
cat "$HOME/.notes" | |
elif [[ "$1" == "-c" ]]; then | |
# clear file | |
printf "%s" > "$HOME/.notes" | |
else | |
# add all arguments to file | |
printf "%s\n" "$*" >> "$HOME/.notes" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment