Fix command line parsing with expr(1) failing if the parameter is 0.

This commit is contained in:
Jonas 'Sortie' Termansen 2017-08-20 12:41:08 +02:00
parent 9ee05a5afc
commit 46862b797f
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ for argument do
fi
case $argument in
*=?*) parameter=$(expr "X$argument" : '[^=]*=\(.*\)') ;;
*=?*) parameter=$(expr "X$argument" : '[^=]*=\(.*\)' || true) ;;
*=) parameter= ;;
*) parameter=yes ;;
esac

View File

@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (c) 2015, 2016 Jonas 'Sortie' Termansen.
# Copyright (c) 2015, 2016, 2017 Jonas 'Sortie' Termansen.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@ -29,7 +29,7 @@ for argument do
continue
fi
case $argument in
*=?*) parameter=$(expr "X$argument" : '[^=]*=\(.*\)') ;;
*=?*) parameter=$(expr "X$argument" : '[^=]*=\(.*\)' || true) ;;
*=) parameter= ;;
*) parameter=yes ;;
esac