Another semi-useful BASH script for account keeping + Programming in Spanish

I'm terrible at keeping my expenses and I really should do something about it. The first part, maybe the easiest, is to keep a registry of expenses that actually makes sense, that is well organized, clear and accesible, so it doesn't become a horrible chore to add new entries... “Where did I leave that little yellow notebook where I was writing down my expenses for like the past three days... can't find it anywhere... meh, I'll use this piece of paper and remember to write it down when I find it, oh, shit, now I need something to write with, ok I'll do it later”... aaand, you never did and now there is no point because what's the use for that data if it's incomplete? Amiright??? The second part, of course, is to do something about that data you have so dutifully registered, but I'll get there when I get there. So I thought about making some simple terminal command that would allow me to quickly enter any new expense, before I forget it, and have a relatively well organized file with all my expenses, even if then I need to manually add the amounts later. Here's what I came up with. The next part would be to make a program that reads the resulting file and takes the numbers from there and add them up. I'm guessing that probably involves regular expressions, tho, and why are they so hard? Or, you know, a sane person would probably tell me “just use a spreadsheet, dude”, but I don't wanna. Incidentally, have you ever tried programming in Spanish? Or any language that is not English, actually. There is no such thing really, us Spanish speakers have to keep switching from one language to another; you can name variables and functions in Spanish, but that is about it. More often than not, for me, it is actually easier ti just think in English.

#!/bin/bash
# appends a string starting with today's date to a file.
# $1: string to input
# $2: file name;

f="[insert directory path here]"$2
str=$1
d="$(date +'%d-%m-%Y')"    # Spanish date format, day-month-year.
day="$(date +'%a')"

# Esta sección es para hispanohablantes, traduce los días de inglés a español.
# Leave this block out if you do not want to translate day names.
case $day in 
	"Mon") day="Lun";;
	"Tue") day="Mar";;
	"Wed") day="Mie";;
	"Thu") day="Jue";;
	"Fri") day="Vie";;
	"Sat") day="Sab";;
	"Sun") day="Dom";;
	*)
esac

d="$day $d"     # generate full date string with day of the week.
new_entry="$d - $1"     # generate complete input string.
echo $new_entry >> $f     # append entry to file.

And that's it. There is probably a lot that can be improved, but it was mostly just an exercise for myself. I learned about switch statements and formatting the 'date' command output.

So after doing the necessary steps to make it executable, it produces something like this:

log "mercado: \$45" gastos.txt

(Remember to escape $ sign if you want to use it).

cat /filepath/gastos.txt =>
Mie 21-01-2021 - mercado: $45