Commit | Line | Data |
---|---|---|
a22c56b3 SBS |
1 | #!/bin/bash |
2 | # Desc: Display message if optionVerbose true | |
3 | ||
4 | vbm() { | |
5 | # Description: Prints verbose message ("vbm") to stderr if optionVerbose is set to "true". | |
dee109ac SBS |
6 | # Usage: vbm "DEBUG :verbose message here" |
7 | # Version 0.1.3 | |
a22c56b3 SBS |
8 | # Input: arg1: string |
9 | # vars: optionVerbose | |
10 | # Output: stderr | |
bb715c40 | 11 | # Depends: bash 5.0.3, echo 8.30, date 8.30 |
a22c56b3 SBS |
12 | |
13 | if [ "$optionVerbose" = "true" ]; then | |
14 | functionTime=$(date --iso-8601=ns); # Save current time in nano seconds. | |
dee109ac | 15 | echo "[$functionTime]:$0:""$*" 1>&2; # Display argument text. |
a22c56b3 SBS |
16 | fi |
17 | ||
18 | # End function | |
19 | return 0; # Function finished. | |
13a63467 | 20 | } # Displays message if optionVerbose true |
a22c56b3 | 21 | |
dee109ac SBS |
22 | #==BEGIN sample code== |
23 | vbm "STATUS:This is a status message."; | |
24 | optionVerbose="true"; | |
25 | vbm "STATUS:This is another status message."; | |
26 | #==END sample code== | |
27 | ||
a22c56b3 SBS |
28 | # Author: Steven Baltakatei Sandoval |
29 | # License: GPLv3+ |