| 1 |
#!/usr/bin/env bash |
| 2 |
# shellcheck disable=SC2154 |
| 3 |
# these top lines are moved during build |
| 4 |
|
| 5 |
echo_message() { |
| 6 |
if [[ ${format} == "csv" ]]; then |
| 7 |
echo -n -e "$2" |
| 8 |
elif [[ ${format} == "xml" ]]; then |
| 9 |
echo -n -e "$3" |
| 10 |
elif [[ ${format} == "json" ]]; then |
| 11 |
echo -n -e "$4" |
| 12 |
else #default to cli |
| 13 |
echo -n -e "${1}" |
| 14 |
fi |
| 15 |
} |
| 16 |
|
| 17 |
# check if input is numeric |
| 18 |
isNumeric() { |
| 19 |
echo "$@" | grep -q -v "[^0-9]" |
| 20 |
} |
| 21 |
|
| 22 |
# check if input is a string |
| 23 |
isString() { |
| 24 |
echo "$@" | grep -q -v "[^ A-Z_a-z]" |
| 25 |
} |