From owner-freebsd-questions@FreeBSD.ORG Sun Jun 6 04:57:42 2010 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98451106566C for ; Sun, 6 Jun 2010 04:57:42 +0000 (UTC) (envelope-from aiza21@comclark.com) Received: from avmxsmtp3.comclark.com (avmxsmtp3.comclark.com [202.69.191.117]) by mx1.freebsd.org (Postfix) with ESMTP id 9DF768FC12 for ; Sun, 6 Jun 2010 04:57:40 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlMWAHvHCkzKRa1aPGdsb2JhbAAHgxaEUpZxAQEBATWteQqPXYEngwNtBINI X-IronPort-AV: E=Sophos;i="4.53,370,1272816000"; d="scan'208";a="2201676" Received: from unknown (HELO [10.0.10.3]) ([202.69.173.90]) by avmxsmtp2.comclark.com with ESMTP; 06 Jun 2010 12:57:37 +0800 Message-ID: <4C0B2AC1.1080805@comclark.com> Date: Sun, 06 Jun 2010 12:57:37 +0800 From: Aiza User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: CyberLeo Kitsana References: <201006051513.o55FDCKj020952@mail.r-bonomi.com> <4C0ADBCF.8040506@comclark.com> <20100606014737.GG85961@dan.emsphone.com> <4C0B1C61.9030501@comclark.com> <4C0B26B5.3090901@cyberleo.net> In-Reply-To: <4C0B26B5.3090901@cyberleo.net> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit Cc: "questions@freebsd.org" , Dan Nelson Subject: Re: .sh & getopts X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2010 04:57:42 -0000 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.