-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 06/06/2010 08:40:56, Aiza wrote:
> I have been looking for documentation on freebsd's sh shell programming.
> Want to understand what is happening in that getopts I posted. Where can
> I find real explanations?
Well, the essential reference is the
Matthew Seaman wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 06/06/2010 05:57:37, Aiza wrote:
i) action="installworld"; flag_count=$((flag_count+1));;
Try it like this instead:
i) action="installworld"; flag_count=$(( $flag_count + 1 ));;
(Obviously, apply the equivalent change
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 06/06/2010 05:57:37, Aiza wrote:
> i) action="installworld"; flag_count=$((flag_count+1));;
Try it like this instead:
i) action="installworld"; flag_count=$(( $flag_count + 1 ));;
(Obviously, apply the equivalent change to the other lines)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 06/06/2010 02:47:38, Dan Nelson wrote:
>> flag_count=`expr $flag_count + 1`
> /bin/sh can do math on its own:
>
> flag_count=$((flag_count+1))
flag_count=$(( $flag_count + 1 ))
surely? Needs to dereference the variable inside the arithmetic expa
Aiza wrote:
CyberLeo Kitsana wrote:
On 06/05/2010 10:56 PM, Aiza wrote:
i) action="installworld"; $flag_count=$((flag_count+1));;
...
What is still wrong here
Bourne shell expands variables to their contents before evaluating.
Thus, the above assignment ends up expanding to '0=1'. Leave ou
CyberLeo Kitsana wrote:
On 06/05/2010 10:56 PM, Aiza wrote:
i) action="installworld"; $flag_count=$((flag_count+1));;
...
What is still wrong here
Bourne shell expands variables to their contents before evaluating.
Thus, the above assignment ends up expanding to '0=1'. Leave out the $
on th
On 06/05/2010 10:56 PM, Aiza wrote:
>i) action="installworld"; $flag_count=$((flag_count+1));;
> ...
> What is still wrong here
Bourne shell expands variables to their contents before evaluating.
Thus, the above assignment ends up expanding to '0=1'. Leave out the $
on the target variable, and
/bin/sh can do math on its own:
flag_count=$((flag_count+1))
I want to know if more that one flag has been coded on the command.
So add 1 to counter if that flag was processed. After all the flags are
processed and fall out of getopts, then check flag counter for value.
Ok I coded like th
In the last episode (Jun 05), Brandon Gooch said:
> On Sat, Jun 5, 2010 at 6:20 PM, Aiza wrote:
> > Robert Bonomi wrote:
> >>> From: Aiza
> >>> Robert Bonomi wrote:
> > From: Aiza
> >
> > Have this code
> >
> > shift; while getopts :ugr: arg; do case ${arg} in
> > u) a
On Sat, Jun 5, 2010 at 6:20 PM, Aiza wrote:
> Robert Bonomi wrote:
>>>
>>> Date: Sat, 05 Jun 2010 20:51:28 +0800
>>> From: Aiza
>>> To: Robert Bonomi
>>> Subject: Re: .sh & getopts
>>>
>>> Robert Bonomi wrote:
>>>&
Robert Bonomi wrote:
Date: Sat, 05 Jun 2010 20:51:28 +0800
From: Aiza
To: Robert Bonomi
Subject: Re: .sh & getopts
Robert Bonomi wrote:
From owner-freebsd-questi...@freebsd.org Thu Jun 3 23:36:28 2010
Date: Fri, 04 Jun 2010 12:35:56 +0800
From: Aiza
To: "questi...@freebsd
Robert Bonomi wrote:
m
From owner-freebsd-questi...@freebsd.org Thu Jun 3 23:36:28 2010
Date: Fri, 04 Jun 2010 12:35:56 +0800
From: Aiza
To: "questi...@freebsd.org"
Cc:
Subject: .sh & getopts
Have this code
shift; while getopts :ugr: arg; do case ${arg} in
u) action=&
m
> From owner-freebsd-questi...@freebsd.org Thu Jun 3 23:36:28 2010
> Date: Fri, 04 Jun 2010 12:35:56 +0800
> From: Aiza
> To: "questi...@freebsd.org"
> Cc:
> Subject: .sh & getopts
>
> Have this code
>
> shift; while getopts :ugr: arg; do ca
Steve Bertrand wrote:
On 2010.06.04 00:35, Aiza wrote:
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 ))
Comm
On 2010.06.04 00:35, Aiza wrote:
> 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 ))
>
>
> Command bein
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 ))
Command being executed looks like this, cmd action -flags bbb
16 matches
Mail list logo