Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # tivasyk <[email protected]>
- # Template
- TEMPLATE="<YELLOW><HOSTNAME><NORMAL><TAB>| <DATE>, <TIME>"
- PRINT="${TEMPLATE}"
- # Substitute colors
- PRINT="${PRINT//<YELLOW>/$(tput setaf 3)}"
- PRINT="${PRINT//<NORMAL>/$(tput sgr0)}"
- # Substitute formatting
- TAB=$(echo -e '\t')
- PRINT="${PRINT//<TAB>/${TAB}}"
- # Substitute tags
- PRINT="${PRINT//<HOSTNAME>/$(hostname)}"
- PRINT="${PRINT//<DATE>/$(date +'%Y-%m-%d')}"
- PRINT="${PRINT//<TIME>/$(date +'%H:%M')}"
- printf "Template: %s\n" "${TEMPLATE}"
- printf "Substit.: %s\n" "${PRINT}"
Advertisement
Add Comment
Please, Sign In to add comment