From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Taylor Subject: counting shell args Date: Mon, 16 Dec 2002 12:36:02 -0800 Sender: linux-admin-owner@vger.kernel.org Message-ID: <5.1.1.6.0.20021216123048.01c06918@mustang> Mime-Version: 1.0 Return-path: List-Id: Content-Type: text/plain; charset="us-ascii"; format="flowed" Content-Transfer-Encoding: 7bit To: linux-admin@vger.kernel.org I'm sure I've seen, probably even use it before, but I can't remember or find it now; does anyone remember how to count the number of arguments sent to a bash script? Like "if [ -z $3 ]; then" ... of corse that's for testing argument 3 exists, but how do I test if 3 arguments and only 3, are passed to the script (or 1 or 10 or whatever). Don't you just hate it when that happens. =P