Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jun 2007 12:59:34 -0400
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Olivier Regnier <oregnier@oregnier.net>, freebsd-questions@freebsd.org
Subject:   Re: problem with printf in a shell script
Message-ID:  <p06240800c29dbb89ac98@[128.113.24.47]>
In-Reply-To: <4677FFD1.9050603@oregnier.net>
References:  <4677FE32.9040703@oregnier.net> <4677FFD1.9050603@oregnier.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p06240800c29dbb89ac98>