Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I set PROMPT_CMD to the following function:

    function log_history {
        echo "`date '+%Y-%m-%d %H:%M:%S'` $HOSTNAME:$$ $PWD ($?) `history 1`" >> $MYHISTFILE
    }
which records a timestamp, host name, shell pid, working directory and exit status for each command.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: