From owner-freebsd-questions@FreeBSD.ORG Thu Sep 20 02:25:19 2012 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 71489106566C for ; Thu, 20 Sep 2012 02:25:19 +0000 (UTC) (envelope-from mihai.dontu@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id F3F8F8FC08 for ; Thu, 20 Sep 2012 02:25:18 +0000 (UTC) Received: by wgi16 with SMTP id 16so1291103wgi.31 for ; Wed, 19 Sep 2012 19:25:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:organization :mime-version:content-type:content-transfer-encoding; bh=yROs6KVi+dIawxxaqHR2dkk9xhlQsf5IFknMOclD/yw=; b=nZQhOccSEcPPMUkP7Gwm5pzyM+OYQOwtOIRs48AvIDmu1qiAUNl0lsV+gnAeQWDrFn wqG+h1SOxbDS/r70eW+VtpgWKJ5R++areRd0JNY4fotra18VJg1o/rNK+RQfCDmuau9b d7098VpfLk6mURybBWG/q7zSMAOeLOsG6clMYke9PSatCdzxBNWIaiZFZTbBDntfkEzm 9f9KkQfWztxRVqSc/6VjeNT8V/M+s80asKIXc4bws6SKVh4yg+hYf1AL4KgFHCXSYnc5 eJdJCnZWoSgFCgMH5OyZAm1nYJ/eCd5fFxnI7ihwUg2f9ObK+FdBt/jU4xQPLCDXlb0B cDOw== Received: by 10.180.24.197 with SMTP id w5mr2470894wif.22.1348107917756; Wed, 19 Sep 2012 19:25:17 -0700 (PDT) Received: from mdontu-l.dsd.ro (5-12-81-19.residential.rdsnet.ro. [5.12.81.19]) by mx.google.com with ESMTPS id k2sm8118969wiz.7.2012.09.19.19.25.16 (version=SSLv3 cipher=OTHER); Wed, 19 Sep 2012 19:25:16 -0700 (PDT) Date: Thu, 20 Sep 2012 05:25:15 +0300 From: Mihai =?UTF-8?B?RG9uyJt1?= To: freebsd-questions@freebsd.org Message-ID: <20120920052515.4ab8a317@mdontu-l.dsd.ro> In-Reply-To: <201209200203.q8K23Bv5034624@x.it.okstate.edu> References: <201209200203.q8K23Bv5034624@x.it.okstate.edu> Organization: Home Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: bash Shell Scripting Question 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: Thu, 20 Sep 2012 02:25:19 -0000 On Wed, 19 Sep 2012 21:03:11 -0500 Martin McCormick wrote: > #!/usr/local/bin/bash=20 > ls -LF |grep \/ >/tmp/files > while read dirname; do > cd $dirname > #Do whatever commands to be repeated in each directory. > done < /tmp/files >=20 How about: ls -LF | grep \/ | while read dirname; do cd $dirname # do stuff done or: find . -maxdepth 1 -type d | while read dirname; do cd $dirname # do stuff done or even: find . -maxdepth 1 -type d ! -name ".*" | while read dirname; do cd $dirname # do stuff done --=20 Mihai Don=C8=9Bu