This is sort of a contiunation of my last question: printing saving the last bash input commandNow I want to know if it's possible to know when you're at the first bash prompt of a terminal. So I'm displaying the last command run above the current prompt. And I'm thinking it would be cool if when you're at a fresh terminal, to display the last N commands.I guess I could just echo the last commands inside my .bashrc, but that doesn't seem like a good idea. And also it'd be cool to get the last N commands shown when the scrollback is cleared (via clear).Is any of that (reasonably) possible?
Is it possible to know when you're at the first bash prompt of a terminal?
bash;prompt
I guess I could just echo the last commands inside my .bashrc, but that doesn't seem like a good idea. And also it'd be cool to get the last N commands shown when the scrollback is cleared (via clear).I'm not sure there's another way to do it without modifying the bash source... What seems bad about putting it in .bashrc though? You should just add an interactivity test so it doesn't print it in any script :if [ ! -z $PS1 ]; then    echo Hello, the last 5 commands you typed were :    tail -n5 ~/.bash_historyfiYou could also create an alias for clear which basically does the same.