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 the $
on the target variable, and it becomes 'flag_count=1', which is more
likely what you intended.


i) action="installworld"; flag_count=$((flag_count+1));;

But when tested it just put 1 into flag_count. it is not adding one to the value all ready in flag_count.

Stilling missing the point here
I want to perform math here. if more than one flag is coded them I want the count to increase by 1 for each flag on the command, not change the contents of the count to 1.

Again take note this is .sh shell type.

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 ))

doing more testing if found that the above $(( ${OPTION} -1 )) subtraction is not work either.

echo "OPTION = $OPTION" shows a value of 5, which is the 4 flags plus the leading parm. I thought $(( ${OPTION} -1 )) meant it was subtracting 1 from the parm count which should make it 4 which is the number of flags i passed.
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"

Reply via email to