mirror of
https://github.com/ben-grande/qusal.git
synced 2025-08-01 18:56:12 -04:00
fix: avoid echo usage
Echo can interpret operand as an option and checking every variable to be echoed is troublesome while with printf, if the format specifier is present before the operand, printing as string can be enforced.
This commit is contained in:
parent
1b2f1ba941
commit
bdd4c789c1
52 changed files with 318 additions and 270 deletions
|
@ -23,15 +23,15 @@ host="${arg%%+*}"
|
|||
port="${arg##*+}"
|
||||
|
||||
if test -z "${port}" || test -z "${host}" || test "${port}" = "${host}"; then
|
||||
echo "Missing either host, port or both" >&2
|
||||
printf '%s\n' "Missing either host, port or both" >&2
|
||||
exit 1
|
||||
fi
|
||||
if test "${#host}" -gt 256; then
|
||||
echo "Host size exceeds limit" >&2
|
||||
printf '%s\n' "Host size exceeds limit" >&2
|
||||
exit 1
|
||||
fi
|
||||
if test "${#port}" -gt 5 || test "${port}" -gt 65535; then
|
||||
echo "Invalid port number, it must be between 1 and 65535" >&2
|
||||
printf '%s\n' "Invalid port number, it must be between 1 and 65535" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue