5 ms·
My append-only system for *nix, sits in my .bashrc: # Open Personal Logfile at end, optionally appending log entry for today if it doesn't exist function e
by beembeem 5y ago
My append-only system for *nix, sits in my .bashrc:
# Open Personal Logfile at end, optionally appending log entry for today if it doesn't exist
function ed ()
{
local _cur_date _most_recent_date;
_cur_date=$(date +%m/%d/%Y);
_most_recent_date=$(grep --color -o -E "^# [0-9]{2}/[0-9]{2}/[0-9]{4}" ~/${LOG_FILE_NAME} | tail -n 1 | cut -d' ' -f2-);
if [[ "${_cur_date}" != "${_most_recent_date}" ]]; then
echo -e "\n#\n# ${_cur_date}\n#" >> ~/${LOG_FILE_NAME};
echo "Command Comments" >> ~/${LOG_FILE_NAME};
printf "%0.s-" {1..81} >> ~/${LOG_FILE_NAME};
echo >> ~/${LOG_FILE_NAME};
fi;
$EDITOR +$(($(wc -l ~/${LOG_FILE_NAME} | awk '{print $1}')+1)) ~/${LOG_FILE_NAME}
}
>>>
#
# 12/03/2021
#
Command Comments
---------------------------------------------------------------------------------
<some cmd> # My description of what cmd does, in my own words
- jldugger 5y agoa few months ago, some folks on HN pointed me at https://jrnl.sh/en/stable/ https://jrnl.sh/en/stable/