[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: let's set the positional parameters with a simple 'read'
From: |
Eric Blake |
Subject: |
Re: let's set the positional parameters with a simple 'read' |
Date: |
Tue, 03 Jan 2012 10:52:54 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 |
On 01/03/2012 10:46 AM, jidanni@jidanni.org wrote:
>>>>>> "GW" == Greg Wooledge <wooledg@eeg.ccf.org> writes:
> GW> Why not just use a named array?
> GW> $ read -a myarray
> But does that let me get a my favorite array, the positional parameters?
Any time you want to assign the positional parameters, use set. It's as
simple as that. What's wrong with:
read -a myarray
set -- "${myarray[@]}"
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature