In the last episode (Jun 05), Brandon Gooch said:
> On Sat, Jun 5, 2010 at 6:20 PM, Aiza <[email protected]> wrote:
> > Robert Bonomi wrote:
> >>> From: Aiza <[email protected]>
> >>> Robert Bonomi wrote:
> >>>>> From: Aiza <[email protected]>
> >>>>>
> >>>>> Have this code
> >>>>>
> >>>>> shift; while getopts :ugr: arg; do case ${arg} in
> >>>>>    u) action="freebsd-update";;
> >>>>>    g) action="freebsd-upgrade";;
> >>>>>    r) action="freebsd-rollback";;
> >>>>>    ?) exerr ${cmd_usage};;
> >>>>> esac; done; shift $(( ${OPTION} -1 ))
> >>>>>
> >
> > flag_count=0
> > shift; while getopts :ugr: arg; do
> >  flag_count + 1;
> >  case ${arg} in
> >     u) action="freebsd-update";;
> >     g) action="freebsd-upgrade";;
> >     r) action="freebsd-rollback";;
> >     ?) exerr ${cmd_usage};;
> >  esac; done; shift $(( ${OPTION} -1 ))
> >
> >
> >  if flag_count gt 3; then
> >    exerr ${cmd_usage}
> >  fi
> >
> >
> > I think I got the concept correct, but the flag_count + 1 is not correct. I
> > get "flag_count: not found" when I run it this way.
> 
> You could use:
> 
> flag_count=`expr $flag_count + 1`

/bin/sh can do math on its own:

flag_count=$((flag_count+1))


-- 
        Dan Nelson
        [email protected]
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"

Reply via email to