I'm new to
bash and scripting.
I was thinking of writing an alias or a script so that every time I
exit the command line, it will record my command history. Because I try a lot of new commands, and I would like to go back to the file and make comments to it, so I can learn better and not just try the commands and then forget them completely.
alias exit ="history > `date +%Y-%m-%d`.txt; exit"
but when I reload my bash, I get:
-bash: alias: exit: not found -bash: alias: =history > 2015-09-22.txt; exit: not found
Why doesn't this work? Should I try to write a script with a while loop instead?