[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
$OPTIND varibale value is different from sh
From: |
Hyunho Cho |
Subject: |
$OPTIND varibale value is different from sh |
Date: |
Wed, 20 Jun 2018 17:16:48 +0900 |
if $OPTIND value start from 1 then i think "-b" $OPTIND should be "3" like sh
but bash print "2"
set -- -a -bc hello world
echo $OPTIND # sh, bash = 1
getopts abc opt "$@"
echo $opt, $OPTIND # sh, bash = a, 2
getopts abc opt "$@" # bash = b, 2 <------ different
from "sh"
echo $opt, $OPTIND # sh = b, 3
getopts abc opt "$@" # sh, bash = c, 3
echo $opt, $OPTIND
- $OPTIND varibale value is different from sh,
Hyunho Cho <=