From owner-freebsd-questions@FreeBSD.ORG Sun Aug 12 18:34:07 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 EC4E516A41B for ; Sun, 12 Aug 2007 18:34:07 +0000 (UTC) (envelope-from derek@computinginnovations.com) Received: from betty.computinginnovations.com (mail.computinginnovations.com [64.81.227.250]) by mx1.freebsd.org (Postfix) with ESMTP id 96F1613C474 for ; Sun, 12 Aug 2007 18:34:07 +0000 (UTC) (envelope-from derek@computinginnovations.com) Received: from p28.computinginnovations.com (dhcp-10-20-30-100.computinginnovations.com [10.20.30.100]) (authenticated bits=0) by betty.computinginnovations.com (8.13.8/8.12.11) with ESMTP id l7CIXntH027879; Sun, 12 Aug 2007 13:33:49 -0500 (CDT) Message-Id: <6.0.0.22.2.20070812133145.0263fbe0@mail.computinginnovations.com> X-Sender: derek@mail.computinginnovations.com X-Mailer: QUALCOMM Windows Eudora Version 6.0.0.22 Date: Sun, 12 Aug 2007 13:33:26 -0500 To: Rakhesh Sasidharan , freebsd-questions@freebsd.org From: Derek Ragona In-Reply-To: <20070812195535.V86618@obelix.home.rakhesh.com> References: <20070812195535.V86618@obelix.home.rakhesh.com> Mime-Version: 1.0 X-ComputingInnovations-MailScanner-Information: Please contact the ISP for more information X-ComputingInnovations-MailScanner: Found to be clean X-ComputingInnovations-MailScanner-From: derek@computinginnovations.com X-Spam-Status: No Content-Type: text/plain; charset="us-ascii"; format=flowed X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: Question on the IFS variable (not a FreeBSD 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: Sun, 12 Aug 2007 18:34:08 -0000 At 10:57 AM 8/12/2007, Rakhesh Sasidharan wrote: >Hi, > >This isn't really a FreeBSD question. But I figure most people on this >list would know the answer and so I'm asking. I've tried to get the answer >out of Google, but I guess I am not asking it the right question and so >not getting much hits. > >I understand that the default value of the IFS variable in bash is "space, >tab, newline". For a script I am playing around with, I want to change IFS >to be just newline. I tried the obvious like > >IFS="\n" >-or- >IFS='\n' > >but that doesn't seem to do the trick coz then the letter "n" ends up >being the separator. > >A bit of Google searching got me the solution too. That I must set IFS >this way: > >IFS=$'\n' > >I did that, and sure enough things work the way I want! > >So my question is this: how come things work when I set IFS to $'\n' >instead of just plain '\n'? I don't recollect seeing such a way of setting >variables before, and so I'm curious about it. This is dependent on the shell you use, and how it interprets character sequences looking for escape characters and such. This will differ between shells. -Derek -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks transtec Computers for their support.