From owner-freebsd-questions Thu Jul 4 14: 6:11 2002 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 C97C237B400 for ; Thu, 4 Jul 2002 14:06:08 -0700 (PDT) Received: from mta7.pltn13.pbi.net (mta7.pltn13.pbi.net [64.164.98.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 89E5F43E4A for ; Thu, 4 Jul 2002 14:06:08 -0700 (PDT) (envelope-from mbsd@pacbell.net) Received: from atlas ([64.168.26.81]) by mta7.pltn13.pbi.net (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTP id <0GYQ00EP9TA7NS@mta7.pltn13.pbi.net> for freebsd-questions@FreeBSD.ORG; Thu, 04 Jul 2002 14:06:08 -0700 (PDT) Date: Thu, 04 Jul 2002 14:06:07 -0700 (PDT) From: "M.T." Subject: Re: Shell Script gurus?? In-reply-to: <20020704132754.E21920-100000@njam.dhs.org> X-X-Sender: mikko@atlas.home To: Viktor Lazlo Cc: Odhiambo Washington , freebsd-questions@FreeBSD.ORG Message-id: <20020704140403.L333-100000@atlas.home> MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII Content-transfer-encoding: 7BIT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 4 Jul 2002, Viktor Lazlo wrote: > > > On Thu, 4 Jul 2002, Odhiambo Washington wrote: > > > Now in my script I am reading the domain name from stdin (?? > > > > echo Entering domain name in MySQL DB: > > echo "" > > domain_name= > > echo -n Please supply the domain name to activate: > > read domain_name > > > > > > The domain name can be domain.com or the domain.co.ke but I am interested > > in the part before the first (.) so that I can manipulate some parameter > > with it. > > > > How do I get that alone in a shell after I've read the domain name into > > a variable?? > > I'm sure there's much slicker ways of going about doing it but this works > for me: You mean something like: domain_name="${domain_name%%.*}" :-) /Mikko > read var1 > var2=`echo $var1 | sed -n 's/\.com//p'` > > Regards, > > Viktor > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message