magicant / yash

Yet another shell
http://magicant.github.io/yash/
GNU General Public License v2.0
346 stars 30 forks source link

`typeset -fp` may print ill-formed command substitution #21

Open magicant opened 1 year ago

magicant commented 1 year ago

(Issue migrated from https://osdn.net/projects/yash/ticket/43410)

Describe the bug typeset -fp prints command substitutions in the $() format even if the original function definition contained them in the backquoted form. In doing so, some quotations may not retain their exact semantics.

To Reproduce

$ foo() { `'`; }
$ typeset -fp foo
foo()
{
   $(')
}

$(') does not parse the same as the original backquoted command substitution.

Expected behavior The printed function body should include the same backquoted command substitution.