[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setvalue builtin command
From: |
Dan Douglas |
Subject: |
Re: setvalue builtin command |
Date: |
Thu, 04 Apr 2013 02:26:34 -0500 |
User-agent: |
KMail/4.8.3 (Linux/3.4.6-pf+; KDE/4.8.3; x86_64; ; ) |
On Wednesday, April 03, 2013 11:53:48 PM konsolebox wrote:
> Hi. I made a post on this before but I haven't got a reply. I actually want
> to know what people think about the idea as I actually find a command like
> this really helpful. Anyone please?
>
> On Wed, Feb 6, 2013 at 11:30 AM, konsolebox <konsolebox@gmail.com> wrote:
>
> > Hi. I was wondering if we could add a builtin where we could use it as an
> > alternative for assigning values to a parameter. And thought of a builtin
> > name called setvalue. With it we could assign values to a normal variable,
> > an array, or an associative array.
This is more or less identical to the ksh88 `set -A'. If anything were to be
added, it would probably be that. I assume Chet preferred enforcing more
consistent syntax rather than adding something redundant to ksh93-like
compound assignment syntax.
The primary advantages to set -A are:
- It's the most portable way to assign multiple elements to an indexed array
other than a separate assignment for each element.
- The combination `set -sA' provides a means of sorting (lexicographically).
Bash currently has no built-in way to sort an array or the positional
parameters.
--
Dan Douglas