-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roy Marples wrote:
> On Thu, 2007-10-04 at 05:03 +0100, Steve Long wrote:
>> Donnie Berkholz wrote:
>>
>>> spec=$(echo ${CHOST} | cut -d- -f3)
>>>
>> You can do this without resort to an external process:
>> IFS=-
>> read _ _ spec _ <<< "$CHOST"
>> unset IFS
>> - or you can do:
>> IFS=-
>> arr=($CHOST)
>> unset IFS
>> spec=${arr[2]}
> 
> See, another use of bash arrays just because you can?
> IFS=-
> set -- ${CHOST}
> spec=$2
> 
> Works fine in bash - and other shells.

Do I understand correctly that this resets any arguments that might have been
passed to the function this happens to be in?

Marijn

- --
Marijn Schouten (hkBst), Gentoo Lisp project
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHBLgZp/VmCx0OL2wRAi3wAKCAe/AWWNdTgLDrXxyTBdr4MxW4awCcCsQ7
To3EzKgOPonDwvAmypVdIrA=
=tZYe
-----END PGP SIGNATURE-----
-- 
[EMAIL PROTECTED] mailing list

Reply via email to