Date: Thu, 04 Jul 2002 14:06:07 -0700 (PDT) From: "M.T." <mbsd@pacbell.net> To: Viktor Lazlo <viktorlazlo@telus.net> Cc: Odhiambo Washington <wash@wananchi.com>, freebsd-questions@FreeBSD.ORG Subject: Re: Shell Script gurus?? Message-ID: <20020704140403.L333-100000@atlas.home> In-Reply-To: <20020704132754.E21920-100000@njam.dhs.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020704140403.L333-100000>
