Skip to content

Commit

Permalink
Add warning bash function
Browse files Browse the repository at this point in the history
* Allows displaying a warning, colored yellow, which is output to stderr
  • Loading branch information
Stretch96 committed Oct 4, 2024
1 parent 1aebd9c commit 80d54f9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/bash-functions/warning.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -e
set -o pipefail

# Set up a handy repeatable warning output function that uses `stderr`
#
# @usage warning "Something may be wrong!"
# @param $* Any information to pass into stderr
function warning {
yellow='\033[33m'
clear='\033[0m'

echo -e "${yellow}[!] Warning: ${clear}$*" >&2
}

0 comments on commit 80d54f9

Please sign in to comment.