Skip to content

Instantly share code, notes, and snippets.

@joelhoro
Created January 18, 2020 15:58
Show Gist options
  • Save joelhoro/c744f78bb015ae54fdf8c30938fa190c to your computer and use it in GitHub Desktop.
Save joelhoro/c744f78bb015ae54fdf8c30938fa190c to your computer and use it in GitHub Desktop.
Logit function in bash
ROOTPATH=/tmp
logit() {
local label=$1
shift
local filename="$ROOTPATH/$label-`date +%Y%m%d.%H%M%S`.log"
echo "Logging '$@' to $filename"
$@ > $filename
}
### example use
###
### joel@HPJoel:~$ logit mylist ls -al
### Logging 'ls -al' to /tmp/mylist-20200118.105725.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment