Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue parsing zsh nested expansion. #87

Open
kevincox opened this issue Nov 21, 2022 · 1 comment
Open

Issue parsing zsh nested expansion. #87

kevincox opened this issue Nov 21, 2022 · 1 comment

Comments

@kevincox
Copy link

root_usage="Size: 222151426, NumBlocks: 20587"
root_usage=${${root_usage##Size: }%,*}
echo $root_usage # Prints 222151426
resholve --overwrite my-script
                                                root_usage=${${root_usage##Size: }%,*}
                                                              ^
my-script:57: error: Expected } to close ${

Note that this syntax isn't supported by bash so that may be why it isn't supported.

$ root_usage=${${root_usage##Size: }%,*}
bash: ${${root_usage##Size: }%,*}: bad substitution

Workaround

eval 'root_usage=${${root_usage##Size: }%,*}'

This just gives a warning.

                                                eval 'root_usage=${${root_usage##Size: }%,*}'
                                                     ^
my-script:57: FEEDBACK WANTED: Letting quoted 'eval' through for now.
@abathur
Copy link
Owner

abathur commented Nov 21, 2022

You've got the cause right. Thanks for documenting it along with a simple enough workaround.

The osh parser is mostly bash compatible, but there are definitely zshisms that it can't parse. In the longer run I'm open to the idea of trying to abstract oil bits resholve leans on well enough to slot in other parsers, but it'd be a fair amount of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants