-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
command exit and \exit don't work to suppress function/alias lookup in OSH, because exit is a keyword #2228
Comments
Thanks for trying it That is a known difference - https://oils.pub/release/latest/doc/known-differences.html#break-continue-return-are-keywords-not-builtins We are "conceding to reality" on some of these differences, but it's prioritized by running real shell scripts If you have an example of a real shell script it breaks, that will take priority If it's a synthetic case, then it's lower priority Right now the top issue is that our IFS algorithm needs to be rewritten, since that blocks some real shell scripts There are some threads on Zulip about this too |
I should have read the docs before posting - thanks for linking to it. It's just used in my personal shell scripts, so nothing like a high profile real world use case. I didn't know about the IFS incompatibilities - that would definitely also break my scripts. |
No problem, it's useful to know that people ran into this in their own scripts! Examples can help Sometimes people test synthetic cases, which is also welcome, but it is lower priority |
The script I used, which is the same as the one in #2224, is now published in the linked pull request above. The less mainstream use of shell commands that encountered this issue can be seen in the |
OK yeah I can see that other people may use this idioms to suppress alias and function lookup And there is probably a way to implement it in OSH which is not too hard ... we could make |
So I played around with
command -V
in OSH and noticed that among the special built-in utilities,break
,continue
,exit
andreturn
are actually shell keywords. This means that the following code won't work:command
without options can suppress alias substitution, shell function lookup, as well as special properties of the special built-in utilities (though this last functionality is not respected in some shells): https://pubs.opengroup.org/onlinepubs/9799919799/utilities/command.html.exit
may be aliased (even in OSH, though I don't think it's possible to invoke the alias instead of the keyword), but neither methods of suppressing alias substitution can be used on it.Do you plan to implement this "quirk and bug" of bash and other POSIX-compatible shells?
The text was updated successfully, but these errors were encountered: