I want to pass some interger number using getopt.
This is what I have tried:
if ! options=$(getopt -o n: -l num: -- $@)
then
exit 1
fi
set -- $options
while [ $# -gt 0 ]
do
case $1 in
-n|--num) number=$2 ; shift;;
esac
shift
done
echo $number
The Problem is that if I run
./test.sh --num 10
it echos
'10' instead of 10
and I cant use it as and integer.
Any Help is welcome!