bug-bash
[Top][All Lists]
Advanced

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

Re: certain strings both legal and illegal as associative array keys


From: vampyrebat
Subject: Re: certain strings both legal and illegal as associative array keys
Date: Tue, 03 Mar 2015 01:55:55 -0600

Thank you, Greg, for the quick, helpful response.

> Your best bet is to store the
> index in a variable instead of trying to deal with multiple levels
> of quoting in the same argument.

In the script where this problem arose, the index is indeed stored in a 
variable, and I tried various ways of quoting it.

> imadev:~$ i="a'b"
> imadev:~$ unset 'foo[$i]'

However, I did not try that way, because -- according to the bash documentation 
-- it shouldn't work.  Single quotes should prevent the expansion of $i.  Even 
knowing now that this does work, I can't find where this exception to 
single-quote behavior is documented.



reply via email to

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