From owner-freebsd-questions@FreeBSD.ORG Fri Jun 4 04:36:04 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 53802106566B for ; Fri, 4 Jun 2010 04:36:04 +0000 (UTC) (envelope-from aiza21@comclark.com) Received: from avmxsmtp1.comclark.com (avmxsmtp1.comclark.com [202.69.191.115]) by mx1.freebsd.org (Postfix) with ESMTP id D728F8FC19 for ; Fri, 4 Jun 2010 04:36:03 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhscAMsfCEzKRa1aPGdsb2JhbAAHh2aWVgEBAQE1J74/hRYEg0Y X-IronPort-AV: E=Sophos;i="4.53,358,1272816000"; d="scan'208";a="1912192" Received: from unknown (HELO [10.0.10.3]) ([202.69.173.90]) by avmxsmtp5.comclark.com with ESMTP; 04 Jun 2010 12:36:01 +0800 Message-ID: <4C0882AC.4000504@comclark.com> Date: Fri, 04 Jun 2010 12:35:56 +0800 From: Aiza User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: "questions@freebsd.org" Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: .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: Fri, 04 Jun 2010 04:36:04 -0000 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 aaaa bbbb Only a single -flag in allowed on the command. $# gives a count of parms ie: aaaa bbbb. in this example a count of 2. I am looking for something to check that holds the number of flags on the command. so I can code. if flag_count gt 1 = error Is there such a thing created by getopts?