Skip to content

Instantly share code, notes, and snippets.

@brunoluz
Created December 4, 2020 02:43
Show Gist options
  • Save brunoluz/8ecbe94d4c0ed5904d4ec0f81417eef5 to your computer and use it in GitHub Desktop.
Save brunoluz/8ecbe94d4c0ed5904d4ec0f81417eef5 to your computer and use it in GitHub Desktop.
To write stdin in a daily log basis. Usage: {command} | ./std_handler.sh {log_filename}
#!/bin/bash
while read line; do
echo "${line}" | tee -a "$1.$(date '+%Y%m%d').log"
done < /dev/stdin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment