Created
January 18, 2020 15:58
-
-
Save joelhoro/c744f78bb015ae54fdf8c30938fa190c to your computer and use it in GitHub Desktop.
Logit function in bash
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
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