date >> notes.txt
it would be a great immutable ledger . $ alias dn='date >> notes.txt && cat >> notes.txt <<EOF'
$ dn
> Reply to https://news.ycombinator.com/item?id=32507878
> alias dn='date >> notes.txt && cat >> notes.txt <<EOF'
> EOF
$ cat notes.txt
Thu 18 Aug 2022 01:41:18 PM UTC
Reply to https://news.ycombinator.com/item?id=32507878
alias dn='date >> notes.txt && cat >> notes.txt <<EOF'Interactive editors like vi/emacs also need to flush the buffer and save the content to the file, but you have to type something, such as ":w" and "C-x C-s" (or use GUI).
If you want full automation without human input, I/O redirection is the way.