bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: currently doable? Indirect notation used w/a hash


From: Chris F.A. Johnson
Subject: Re: currently doable? Indirect notation used w/a hash
Date: Mon, 10 Jun 2013 10:34:41 -0400 (EDT)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

On Mon, 10 Jun 2013, Greg Wooledge wrote:

On 10 Jun 2013 14:15, "Chris F.A. Johnson" <chris@cfajohnson.com> wrote:
   It is not the least bit difficult with eval:

eval "array=( \"\${$1[@]}\" )"

On Mon, Jun 10, 2013 at 09:17:23PM +0800, Chris Down wrote:
Enjoy your arbitrary command execution.

To be fair, Chris Johnson was probably assuming a programming environment
where the function is only callable from within the same script, and
thus has only trustworthy arguments provided by the caller.  Sometimes,
this is the case.  Sometimes, it isn't.

   The example I gave is always safe; it expands, given 'q' as the argument, to:

array=( "${q[@]}" )

   What's unsafe about that? Why would it need any preprocessing?

--
   Chris F.A. Johnson, <http://cfajohnson.com/>
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]