Set default in parameter expasion to avoid do-rebase exit due an unset var

The script has set -u so calling do-rebase --help fails with the following:

  $ ./do-rebase --help
  ./do-rebase: line 16: $1: unbound variable

Avoid this by setting a default value when doing the parameter expansion
for the positional parameter $1 passed to the usage() function.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2018-05-14 17:43:51 +02:00 committed by Peter Jones
parent 070bb462db
commit 44d0f31d1f

View file

@ -13,7 +13,7 @@ alias formatpatch="othergit format-patch $format_patch_ops"
usage()
{
retcode=0
if [ -n "$1" ]; then
if [ -n "${1:-}" ]; then
exec 1>&2
retcode=$1
fi