From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-user+bounces-122905-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1QMLN1-0004Lc-UM
	for garchives@archives.gentoo.org; Tue, 17 May 2011 14:35:36 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id C73911C0BE;
	Tue, 17 May 2011 14:34:11 +0000 (UTC)
Received: from svr-us4.tirtonadi.com (unknown [69.65.43.212])
	by pigeon.gentoo.org (Postfix) with ESMTP id A38971C0BE
	for <gentoo-user@lists.gentoo.org>; Tue, 17 May 2011 14:34:11 +0000 (UTC)
Received: from mail-iy0-f181.google.com ([209.85.210.181])
	by svr-us4.tirtonadi.com with esmtpsa (TLSv1:RC4-SHA:128)
	(Exim 4.69)
	(envelope-from <pandu@poluan.info>)
	id 1QMLLp-0030CC-S8
	for gentoo-user@lists.gentoo.org; Tue, 17 May 2011 21:34:21 +0700
Received: by iyb26 with SMTP id 26so602240iyb.40
        for <gentoo-user@lists.gentoo.org>; Tue, 17 May 2011 07:34:08 -0700 (PDT)
Precedence: bulk
List-Post: <mailto:gentoo-user@lists.gentoo.org>
List-Help: <mailto:gentoo-user+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-user+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-user+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-user.gentoo.org>
X-BeenThere: gentoo-user@lists.gentoo.org
Reply-to: gentoo-user@lists.gentoo.org
MIME-Version: 1.0
Received: by 10.42.131.199 with SMTP id a7mr874000ict.54.1305642848329; Tue,
 17 May 2011 07:34:08 -0700 (PDT)
Received: by 10.42.227.198 with HTTP; Tue, 17 May 2011 07:34:08 -0700 (PDT)
In-Reply-To: <201105171536.26328.wonko@wonkology.org>
References: <4DD1AEC8.5010501@earthlink.net>
	<BANLkTi=Zp3tQzqH2bcpWwxcYZxHhS1H+4Q@mail.gmail.com>
	<BANLkTin-bMi_i-GC-439gj_DGSVUXp6Ncg@mail.gmail.com>
	<201105171536.26328.wonko@wonkology.org>
Date: Tue, 17 May 2011 21:34:08 +0700
Message-ID: <BANLkTimf-xJuR5vdrsJsm88EOC=gWjHuqg@mail.gmail.com>
Subject: Re: [gentoo-user] is a nice "place" :-D
From: Pandu Poluan <pandu@poluan.info>
To: gentoo-user@lists.gentoo.org
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - svr-us4.tirtonadi.com
X-AntiAbuse: Original Domain - lists.gentoo.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - poluan.info
X-Archives-Salt: 
X-Archives-Hash: 2427da3a87219a49d66082c8bf709686

On 2011-05-17, Alex Schuster <wonko@wonkology.org> wrote:
> Juan Diego Tasc=C3=B3n writes:
>
>> I have always wondered if there is a way to do awk '{ print $1}' using
>> only builtin bash functions when you only have a one line string
>
> str=3D"one two five"
>
> # remove all from the first blank on, but will not work with
> # other whitespace
> echo ${str%% *}
>
> or
>
> # set $1, $2, $3, ... to words of $str
> set $str
> echo $1
>
> or
>
> # create array holding one word per element
> strarr=3D( $str )
> echo $strarr  (or echo ${strarr[0]})
>
> 	Wonko
>
>

How about this:

str=3D"one two three"
read word etc <<< "$str"
echo $word

(not tested, though)

--
Pandu E Poluan - IT Optimizer
My website: http://pandu.poluan.info/