From owner-freebsd-questions@FreeBSD.ORG Wed Nov 10 19:58:15 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 70DA716A4CE for ; Wed, 10 Nov 2004 19:58:15 +0000 (GMT) Received: from mta10.adelphia.net (mta10.adelphia.net [68.168.78.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1330543D1F for ; Wed, 10 Nov 2004 19:58:13 +0000 (GMT) (envelope-from lists@mactutor.biz) Received: from [192.168.0.22] (really [68.64.69.17]) by mta10.adelphia.net (InterMail vM.6.01.03.02 201-2131-111-104-20040324) with ESMTP id <20041110195812.PKJG18426.mta10.adelphia.net@[192.168.0.22]>; Wed, 10 Nov 2004 14:58:12 -0500 In-Reply-To: <200411101443.01977.personrp@hotpop.com> References: <200411101443.01977.personrp@hotpop.com> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: mailing lists at MacTutor Date: Wed, 10 Nov 2004 14:58:09 -0500 To: personrp@hotpop.com X-Mailer: Apple Mail (2.619) cc: freebsd-questions@freebsd.org Subject: Re: Sed Help..... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Nov 2004 19:58:15 -0000 Rod, Take a look at what the shell replacement is actually doing. If you were to write the line manually it would look like this: sed -e 's/\/usr\X11R6\/bin\/xdm/\/usr\/local\/bin\/kdm/g' ... Right? But the shell doesn't escape the path separators (slashes). You need to escape them yourself in the variable assignments. Like this, KDMLINE='\/usr\/local\/bin\/kdm' &c And if there is only one occurrence per line, then you don't need the 'g' modifier. Hope that helps. Alex On Nov 10, 2004, at 9:43 AM, Rod Person wrote: > I trying to write a script that will make it easier for a friend that I > finally talked into trying Freebsd setup a desktop. > > This part of the script is suppose to change the line in the ttys file > to allow kdm to start on boot. > > Here is the relavent code: > > KDMLINE="/usr/local/bin/kdm -nodaemon" > REPLACELINE="/usr/X11R6/bin/xdm -nodaemon" > > sed -e "s/$REPLACELINE/$KDMLINE/g" /etc/test/ttys > /etc/test/new > > Here is the error I'm getting: > sed: 1: "s//usr/X11R6/bin/xdm -n ...": bad flag in substitute > command: 'X' > > I can't seem to figure this out and the only things I've found in > searching is that sed had a problem with replacing strings over > 4096 bytes, but I don't think this is the cause and all those post > were years old. > > This is on FreeBSD 5.3. > > Rod > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Alexander Sendzimir (owner) 802 863 5502 MacTutor: Apple Mac OS X Consulting info@mactutor.biz