Last active
August 29, 2015 14:27
-
-
Save klmr/f8890faa8a72957a4dd3 to your computer and use it in GitHub Desktop.
Command line drop-in substitute to log diagnostics; simply create a symlink to this wrapper with the target somewhere inside the $PATH, and its name that of a tool to wrap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
logfile="${SHELL_USAGE_LOG-$HOME/shell-usage.log}" | |
cmd=$(basename "$0") | |
real_cmd=$(type -ap "$cmd" | sed -n 2p) | |
echo "[$(date +"%Y-%m-%dT%H:%M")] $(whoami) $SHELL $cmd" >> "$logfile" | |
$real_cmd "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment