Files
config-bash/libs/note.bash
T
xavier df189f9ec1 style: Normalize variable expansions to ${var} across the repo
Replace bare $var with ${var} everywhere it was still used, matching
the convention already established in rc.d/prompt and rc.d/history.
Positional parameters ($1, $@, $#) and special variables ($?, $$, $-)
are left as-is, consistent with existing usage in _helpers.bash.

rc.d/broot is auto-generated by the broot binary and will likely be
overwritten with its original formatting on the next broot update.
2026-08-22 00:55:39 +02:00

18 lines
400 B
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
}