Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14250 > unrolled thread

$OPTIND varibale value is different from sh

Started byHyunho Cho<mug896@naver.com>
First post2018-06-20 17:16 +0900
Last post2018-06-20 17:16 +0900
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

  $OPTIND varibale value is different from sh Hyunho Cho<mug896@naver.com> - 2018-06-20 17:16 +0900

#14250 — $OPTIND varibale value is different from sh

FromHyunho Cho<mug896@naver.com>
Date2018-06-20 17:16 +0900
Subject$OPTIND varibale value is different from sh
Message-ID<mailman.2279.1529482623.1292.bug-bash@gnu.org>
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

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web