Closed
Description
Before we added string interpolation we could do things like this:
alias create my-alias "echo foobar | echo $body[0]"
The variable would then be substituted as normal when the alias was executed.
> my-alias
> foobar
Now when we try to do something like the above the parser returns an error:
Note: error responses are returned as standard command errors. I've just removed everything except the actual error message for brevity.
> alias create my-alias "echo foobar | echo $body[0]"
> illegal characters "$b"
Using the string interpolation syntax doesn't work because the variables are replaced when trying to create the alias, resulting in a "can't find the variable" error.
> alias create my-alias "echo foobar | echo ${body[0]}"
> I can't find the variable '$body'.
Using a slash before the variable allows for successful creation of the alias, but the slash is then displayed in the output when the alias is executed:
> alias create my-alias "echo foobar | echo \$body[0]"
> Alias 'user:my-alias' has been created
> my-alias
> \ foobar