I'm writing a little budget script to keep an eye on my finances. I'd like to keep a log of all of my transactions and when they happened.
Currently, I input spendings as an argument:
f)
echo "$OPTARG spent on food" | tee spendinglogs.log
... # take away money from monthly budget
echo "$REMAINING_FOOD_BUDGET remaining" | tee spendinglogs.log
m)
echo "$OPTARG spent on miscellaneous" | tee spendinglogs.log
... # take away money from monthly budget
echo "$REMAINING_MISC_BUDGET remaining" | tee spendinglogs.log
... #etc
I don't want to timestamp output to the terminal, but I do want to timestamp output to the logs. Is there a way to do this?
For example
echo "$OPTARG spent on food" | tee `date %d-%m-%y %H_%M_%S` spendinglogs.log
But I can't imagine that working.
ts
is a good utility. So far, I was only usingawk
for time-stamping. +1 – Cassimere