[script] fix output when no arguments are specified (#5551)

When no arguments are provided to script/test, the script prints $1:
unbound variable and exits without printing the usage
information. This is due to the set -u at the top.

This commit has a small fix so that this usage is presented with the
usage information. Also, it prints an error when it detect an unknown
command.
This commit is contained in:
Diego Ismirlian
2020-09-23 18:48:37 -07:00
committed by GitHub
parent f77c5d4653
commit ba5231237c
+5 -1
View File
@@ -423,7 +423,7 @@ main()
{
envsetup "$@"
if [[ -z $1 ]]; then
if [[ -z ${1:-} ]]; then
print_usage 1
fi
@@ -469,6 +469,10 @@ main()
shift
do_untar "$@"
;;
*)
echo
echo -e "${COLOR_FAIL}Warning:${COLOR_NONE} Ignoring: '$1'"
;;
esac
shift
done