Add function note
This commit is contained in:
parent
9d20726be7
commit
2f11992488
19
libs/note.bash
Normal file
19
libs/note.bash
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
note () {
|
||||
# if file doesn't exist, create it
|
||||
if [[ ! -f $HOME/.notes ]]; then
|
||||
touch $HOME/.notes
|
||||
fi
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
# no arguments, print file
|
||||
cat $HOME/.notes
|
||||
elif [[ "$1" == "-c" ]]; then
|
||||
# clear file
|
||||
echo "" > $HOME/.notes
|
||||
else
|
||||
# add all arguments to file
|
||||
echo "$@" >> $HOME/.notes
|
||||
fi
|
||||
}
|
Loading…
Reference in New Issue
Block a user