Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <1052752066.3ebfb8c2a9667@webmail.imag.fr> Date: Mon, 12 May 2003 17:07:46 +0200 From: Sylvain DOT Ferriol AT imag DOT fr To: cygwin AT cygwin DOT com Subject: Re: suggestion for cygutils - usermod (was Re: howto change home path in /etc/passwd) References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252;q=1.0 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.1 X-Originating-IP: 152.77.201.128 Surlignage Igor Pechtchanski : > On Mon, 12 May 2003 Sylvain DOT Ferriol AT imag DOT fr wrote: > > > Surlignage Max Bowsher : > > > > > Sylvain DOT Ferriol AT imag DOT fr wrote: > > > > Yes , because i don't want to create a shell doing this: > > > > grep -v $USERNAME /etc/passwd > /etc/passwd > > > > > sorry > > but i don't know with sed how to delete a line starting with $USER > > For the record: "sed '/'$USER':/d". However, grep is perfectly adequate. > What Max was warning you about was the shell redirection mechanism. You'd > be safer using something like > > cp -p /etc/passwd /etc/passwd-bak-tmp && grep -v $USERNAME > /etc/passwd-bak-tmp > /etc/passwd && rm -f /etc/passwd-bak-tmp > is it better to use $USER or $USERNAME?? sylvain > > > Care! That will leave you with an empty /etc/passwd. > > > The shell truncates /etc/passwd BEFORE grep reads it. > > > > > > > mkpasswd -l -u $USERNAME -p $HOME >> /etc/passwd > > > > > > > > sylvain > > > > > > Max. > > Hope this helps, > Igor > -- > http://cs.nyu.edu/~pechtcha/ > |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu > ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com > |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski > '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! > > Knowledge is an unending adventure at the edge of uncertainty. > -- Leto II > > ------------------------------------------------- envoyé via Webmail/IMAG ! -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/