diff options
Diffstat (limited to 'bin/clog.sh')
-rw-r--r-- | bin/clog.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/clog.sh b/bin/clog.sh new file mode 100644 index 00000000..1b612d68 --- /dev/null +++ b/bin/clog.sh @@ -0,0 +1,17 @@ +# Record a timestamped message to a logfile, defaulting to ~/.clog +self=clog + +# Ignore arguments +set -- + +# If we have rlwrap, quietly use it +command -v rlwrap >/dev/null 2>&1 && + set -- rlwrap --history-filename=/dev/null -C "$self" "$@" + +# Write the date, the standard input (rlwrapped if applicable), and two dashes +# to $CLOG, defaulting to ~/.clog. +{ + date + "$@" cat - + printf '%s\n' -- +} >>"${CLOG:-"$HOME"/.clog}" |