Date: Mon, 21 Jun 2010 14:13:09 +0200 From: =?ISO-8859-1?Q?Samuel_Mart=EDn_Moro?= <faust64@gmail.com> To: Aiza <aiza21@comclark.com> Cc: "questions@freebsd.org" <questions@freebsd.org> Subject: Re: .sh for loop Message-ID: <AANLkTinB6FkugAD0GXlF3t-n5dbX39nstbxSxlCxiHje@mail.gmail.com> In-Reply-To: <4C1F4B4C.2000006@comclark.com> References: <4C1F4B4C.2000006@comclark.com>
next in thread | previous in thread | raw e-mail | index | archive | help
it seems to work your main error is to use ${found_name} instead of ${name}. also, you do not set ${group} in your example. and, not essential, but test -z before adding useless spaces. correcting that, I had it working perfectly. h2g2:~# cat test path=3D/dev group=3Dtty for name in "${path}/${group}"* do [ -z "${found_list}" ] && found_list=3D"${name}" || found_list=3D"${found_list} ${name}" done echo "found list: $found_list" h2g2:~# sh test found list: /dev/ttyU0 /dev/ttyU0.init /dev/ttyU0.lock /dev/ttyd0 /dev/ttyd0.init /dev/ttyd0.lock /dev/ttyp0 /dev/ttyp1 /dev/ttyp2 /dev/ttyp3 /dev/ttyp4 /dev/ttyp5 /dev/ttyp6 /dev/ttyp7 /dev/ttyv0 /dev/ttyv1 /dev/ttyv= 2 /dev/ttyv3 /dev/ttyv4 /dev/ttyv5 /dev/ttyv6 /dev/ttyv7 /dev/ttyv8 /dev/ttyv= 9 /dev/ttyva /dev/ttyvb /dev/ttyvc /dev/ttyvd /dev/ttyve /dev/ttyvf h2g2:~# Samuel Mart=EDn Moro {EPITECH.} tek4 CamTrace S.A.S (+033) 1 41 38 37 60 1 All=E9e de la Venelle 92150 Suresnes FRANCE "Nobody wants to say how this works. Maybe nobody knows ..." Xorg.conf(5) On Mon, Jun 21, 2010 at 1:21 PM, Aiza <aiza21@comclark.com> wrote: > for name in "${path}/${group}"*; do > found_list=3D"${found_list} ${found_name}" > done >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinB6FkugAD0GXlF3t-n5dbX39nstbxSxlCxiHje>