Re: Curious bash evaluation

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

 



On Mon, Dec 27, 2010 at 11:30 AM, Rodolfo Alcazar Portillo
<nospaze@xxxxxxxxx> wrote:
> On Mon, 2010-12-27 at 10:46 -0600, inode0 wrote:
>> On Mon, Dec 27, 2010 at 10:05 AM, Rodolfo Alcazar Portillo
>> <nospaze@xxxxxxxxx> wrote:
>> > Hello. See this:
>> >
>> > # A="echo 'hi'"
>> >
>> > # echo $($A)
>> > 'hi'
>>
>> That seems rather convoluted. Are you sure you don't just want to
>> "eval $A" anyway?
>
> Very sure. Not "bash", nor "eval". Just simple command substitution.
> Another reason: it's shorter. Another reason: It must be understood, not
> just avoided in a micro$oft software fashion.

Ok. Quote removal is done at the very end of the expansion process and
only removes unquoted occurrences of \, ', and " that did not result
from an earlier expansion. Since the quotes in this case did occur in
an earlier expansion of the variable A they are left unchanged.

If you want them removed I don't think there is any way to remove them
without doing something like eval to trigger a second round of quote
removal.

John
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux