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

The command block commands require extra escape #41

Open
huawenyu opened this issue Jul 27, 2023 · 1 comment
Open

The command block commands require extra escape #41

huawenyu opened this issue Jul 27, 2023 · 1 comment

Comments

@huawenyu
Copy link

Thanks for the good project, which can help us make better/big-scale bash script.
When port the exist bash script to this new script, found require extra escape \, for example:
The command from bash script like:

grep -E 'NOT|PRODUCT-.*-build02.*\.out\.tgz '

If copy to hush, should be:

grep -E 'NOT|VMWARE-.*-build02.*\\.out\\.tgz '

Could we don't need this extra escape, which can help us copy the command between hush with bash easier?

@gahag
Copy link
Collaborator

gahag commented Aug 4, 2023

This happens because we allow escape sequences inside single quotes in Hush. In Bash, you can't do something like:

echo '\'this is $ingle quoted\''

But in Hush, you can. I guess that in practice this is not really that significant, because one can do:

echo "'"'this is $single quoted'"'"

And this will work in both.

I guess we can consider to remove escape sequences from single quote literals, and then your example would work seamlessly. Thanks for the suggestion, PRs welcome.

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