From owner-freebsd-questions@FreeBSD.ORG Tue Jun 15 12:34:48 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5AF21065670 for ; Tue, 15 Jun 2010 12:34:48 +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 50EBD8FC17 for ; Tue, 15 Jun 2010 12:34:47 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AggUANsPF0zKRa1bPGdsb2JhbAAHh2iXDwEBAQE1v06FGgSDTQ X-IronPort-AV: E=Sophos;i="4.53,420,1272816000"; d="scan'208";a="3978075" Received: from unknown (HELO [10.0.10.3]) ([202.69.173.91]) by avmxsmtp3.comclark.com with ESMTP; 15 Jun 2010 20:34:45 +0800 Message-ID: <4C177363.2050308@comclark.com> Date: Tue, 15 Jun 2010 20:34:43 +0800 From: Aiza User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: RW References: <4C173909.1050101@comclark.com> <4C174283.9090903@comclark.com> <20100615122014.44108373@gumby.homeunix.com> <20100615124709.254fe73e@gumby.homeunix.com> In-Reply-To: <20100615124709.254fe73e@gumby.homeunix.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: * wildcard in.sh script 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: Tue, 15 Jun 2010 12:34:48 -0000 This is the output. want to build list only containing file names prefixed with job. Putting " " around the value on the command line worked. But before this can go to production will have to fix the code so no " " on the command value. # >admin "job*" prefix_name1 = job* prefix_name2 = job if job* != job list all1 = pen2 pen1 job_3 job_2 job_1 cell_B cell_A loop = pen2 pen1 job_3 job_2 job_1 cell_B cell_A* hard stop This is the code. From the results above the "for" is not looping through the file name list. dir=/usr/local prefix_name1=$1 prefix_name2=`echo -n "${prefix_name1}" | sed 's/*.*$//'` echo "prefix_name1 = ${prefix_name1}" echo "prefix_name2 = ${prefix_name2}" echo " if ${prefix_name1} != ${prefix_name2}" if [ "${prefix_name1}" != "${prefix_name2}" ]; then [ -d "${dir}/etc/jail/" ] && \ cd "${dir}/etc/jail/" && list=`ls | xargs rcorder` echo " list all1 = ${list}" # know this worked because see it in the o/p for jail in "${list}"*; do echo "loop = ${jail}" # this only shows first file name in the o/p # though the * on the for command would do globbing done fi exerr "hard stop"