added getopt like error for missing option parameters
This commit is contained in:
parent
8f33d5549f
commit
b02c7c8fb5
8 changed files with 120 additions and 30 deletions
|
@ -49,6 +49,17 @@ Report bugs to <bug-grub@gnu.org>.
|
|||
EOF
|
||||
}
|
||||
|
||||
argument () {
|
||||
opt=$1
|
||||
shift
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "$0: option requires an argument -- '$opt'" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
echo $1
|
||||
}
|
||||
|
||||
# Check the arguments.
|
||||
while test $# -gt 0
|
||||
do
|
||||
|
@ -63,9 +74,7 @@ do
|
|||
echo "$0 (GNU GRUB ${package_version})"
|
||||
exit 0 ;;
|
||||
-o | --output)
|
||||
grub_cfg=$1
|
||||
shift
|
||||
;;
|
||||
grub_cfg=`argument $option "$@"`; shift;;
|
||||
--output=*)
|
||||
grub_cfg=`echo "$option" | sed 's/--output=//'`
|
||||
;;
|
||||
|
@ -74,6 +83,10 @@ do
|
|||
usage
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "Invalid parameter, $option" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue