From owner-freebsd-questions@FreeBSD.ORG Sun Sep 30 15:05:35 2007 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 02D9D16A418 for ; Sun, 30 Sep 2007 15:05:35 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 5B27713C4BE for ; Sun, 30 Sep 2007 15:05:28 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (dialup28.ach.sch.gr [81.186.70.28]) (authenticated bits=128) by igloo.linux.gr (8.14.1/8.14.1/Debian-9) with ESMTP id l8UF4pnT004352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 30 Sep 2007 18:05:19 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.1/8.14.1) with ESMTP id l8UF4m58002334; Sun, 30 Sep 2007 18:04:49 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.1/8.14.1/Submit) id l8UF4erF002333; Sun, 30 Sep 2007 18:04:40 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Sun, 30 Sep 2007 18:04:40 +0300 From: Giorgos Keramidas To: jhall@vandaliamo.net Message-ID: <20070930150439.GB2187@kobe.laptop> References: <21079.67.171.53.31.1191004462.squirrel@admintool.trueband.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21079.67.171.53.31.1191004462.squirrel@admintool.trueband.net> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.911, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.49, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-questions@freebsd.org Subject: Re: Adding CR/LF 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: Sun, 30 Sep 2007 15:05:35 -0000 On 2007-09-28 18:34, jhall@vandaliamo.net wrote: > I know this should be easy, but I cannot get it to work right. > Basically, I have a list of items, and I need to place each one on a > separate line. > > Here is the script I am using. > #!/bin/sh > FILENAMES="test1 test2 test3" > FILELIST="" > for filename in ${FILENAMES} > do > FILELIST="${FILELIST}${filename}"$'\n\r' > echo ${FILELIST} > done > > And, here is the output I am getting. > test1$\n\r > test1$\n\rtest2$\n\r > test1$\n\rtest2$\n\rtest3$\n\r > > The output I would like to see is: > test1 > test2 > test3 How about skipping the trick with '\n\r' altogether? This should work better: #!/bin/sh FILENAMES="test1 test2 test3" for fname in ${FILENAMES} do echo "${fname}" done