Originally Posted by computer_freak_8
Maybe add in an "exit" command at the end of "~/.bashrc"? I'll try that here soon...
Nope. No such luck.
Seriously, though: Is there a Bash variable for the given command? If there is, I'm guessing that would be much easier.
Okay, I realize this may not be clear, so let me try to give a scenario and see if this makes any sense. Note: I don't know if anything like this would work or not; this is just my try at explaining how I think I could get this to work, in theory.
1. I give the command "sudo apt-get update"
2. Bash stores this temporarily in the variable "$command"
3. Instead of just executing the command, Bash sees a section in my "~/.bashrc" file, and pipes the command to it.
The section would be (pseudo-code) something like:
print "$command" >> logfile.txt # append the command to the log
print "\n" >> logfile.txt # append a newline after the command
$command | tee -a logfile.txt # output to the file and the screen
print "\n\n" >> logfile # append two newlines to the logfile, to make it more legible
****Edit: Looking here
, is that what "$FUNCNAME" does? I just now found that link. I'm going to try it here soon.****