Created
December 13, 2019 10:21
-
-
Save strizhechenko/e872ab4ade27f21db14b22e4203b8d49 to your computer and use it in GitHub Desktop.
Тупой логгер, который можно использовать на вызывающей стороне.
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
#!/bin/bash | |
set -euE | |
# echo "$0 $@ [$$] START" >&2 | |
if [ "${1:-}" == '--help' ]; then | |
echo "Info: logger.sh - пишет дату перед каждой строчкой пришедшей на stdin" | |
echo "Usage: my_command.sh 2>&1 | ./logger.sh" | |
echo "Example: logger --help | ./logger.sh" | |
exit 0 | |
fi | |
while IFS= read -r line; do | |
echo "$(date "+%Y.%m.%d %H:%M:%S") $line" | |
done | |
# echo "$0 $@ [$$] SUCCESS" >&2 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment