[Shell] qa(bash): Sets "e" and "u" Shell options
This commits sets the "e" and "u" Shell options for better error handling. Because of "u", an additional test is required before using variable $1.
This commit is contained in:
parent
47b06c778c
commit
a47fed2080
@ -10,6 +10,7 @@
|
|||||||
#
|
#
|
||||||
# Possible usages: see usage_help()
|
# Possible usages: see usage_help()
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
readonly PROGNAME=$(basename $0)
|
readonly PROGNAME=$(basename $0)
|
||||||
readonly PROGDIR=$(readlink -m $(dirname $0))
|
readonly PROGDIR=$(readlink -m $(dirname $0))
|
||||||
@ -119,7 +120,7 @@ fi
|
|||||||
##
|
##
|
||||||
|
|
||||||
MESSAGE_TO_SEND=""
|
MESSAGE_TO_SEND=""
|
||||||
if [ "${1}" ]; then # Message en tant qu'argument de la ligne de commande
|
if [ $# -ge 1 ] && [ "${1}" ]; then # Message en tant qu'argument de la ligne de commande
|
||||||
MESSAGE_TO_SEND="${1}"
|
MESSAGE_TO_SEND="${1}"
|
||||||
else # Message lu de STDIN
|
else # Message lu de STDIN
|
||||||
while read line
|
while read line
|
||||||
|
Loading…
Reference in New Issue
Block a user