-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
-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)
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 to
-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
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 aiz...@comclark.com
To: questi...@freebsd.org questi...@freebsd.org
Cc:
Subject: .sh getopts
Have this code
shift; while getopts :ugr: arg; do case
Robert Bonomi wrote:
Date: Sat, 05 Jun 2010 20:51:28 +0800
From: Aiza aiz...@comclark.com
To: Robert Bonomi bon...@mail.r-bonomi.com
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
On Sat, Jun 5, 2010 at 6:20 PM, Aiza aiz...@comclark.com wrote:
Robert Bonomi wrote:
Date: Sat, 05 Jun 2010 20:51:28 +0800
From: Aiza aiz...@comclark.com
To: Robert Bonomi bon...@mail.r-bonomi.com
Subject: Re: .sh getopts
Robert Bonomi wrote:
From owner-freebsd-questi...@freebsd.org
In the last episode (Jun 05), Brandon Gooch said:
On Sat, Jun 5, 2010 at 6:20 PM, Aiza aiz...@comclark.com wrote:
Robert Bonomi wrote:
From: Aiza aiz...@comclark.com
Robert Bonomi wrote:
From: Aiza aiz...@comclark.com
Have this code
shift; while getopts :ugr: arg; do case ${arg}
/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
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 it
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 the
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 out
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 being executed looks
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 ))
Command
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 aiz...@comclark.com
To: questi...@freebsd.org questi...@freebsd.org
Cc:
Subject: .sh getopts
Have this code
shift; while getopts :ugr: arg; do case ${arg} in
u
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
16 matches
Mail list logo