From owner-freebsd-questions@FreeBSD.ORG Tue Jun 19 18:14:08 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AD32916A468 for ; Tue, 19 Jun 2007 18:14:08 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: from smtp7.server.rpi.edu (smtp7.server.rpi.edu [128.113.2.227]) by mx1.freebsd.org (Postfix) with ESMTP id 5A4C213C483 for ; Tue, 19 Jun 2007 18:14:08 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp7.server.rpi.edu (8.13.1/8.13.1) with ESMTP id l5JGxZc8025626; Tue, 19 Jun 2007 12:59:36 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <4677FFD1.9050603@oregnier.net> References: <4677FE32.9040703@oregnier.net> <4677FFD1.9050603@oregnier.net> Date: Tue, 19 Jun 2007 12:59:34 -0400 To: Olivier Regnier , freebsd-questions@freebsd.org From: Garance A Drosihn Content-Type: text/plain; charset="iso-8859-1" ; format="flowed" Content-Transfer-Encoding: quoted-printable X-RPI-SA-Score: undef - spam scanning disabled X-CanItPRO-Stream: default X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.227 Cc: Subject: Re: problem with printf in a shell 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, 19 Jun 2007 18:14:08 -0000 At 6:09 PM +0200 6/19/07, Olivier Regnier wrote: >Olivier Regnier a =E9crit : >>Hi everyone, >> >>I want to insert text in my file, rc.conf : update_motd=3D"NO" >>I tried printf in my shell script with this command : >>printf "update_motd=3D"\"NO"\"\" >> /etc/rc.conf >>then, that works well in console but not with my shell script >>I would like to insert a \n at the end :) >> >>Can you help me please ? >> > >Sorry :), i founded the solution : >printf 'update_motd=3D"NO"' If you want a newline character at the end of that, then wouldn't you need: printf 'update_motd=3D"NO"\n' Literally the two characters '\n' at the end of the string you're printing? By default, printf does not include a newline. -- Garance Alistair Drosehn =3D gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu