-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fix the script when sourced from zsh #208
base: main
Are you sure you want to change the base?
Conversation
this looks like it might now work in bash? |
I tested it in both bash and zsh, both when sourced or executed directly (however don't see the use case for the latter one). Also ran ./configure with sources novarc and haven't noticed any issues |
There are a number of differences between zsh and bash. So it's going to be difficult for a script to work in both shells. A simple workaround is (assuming user starts in zsh):
If that's not acceptable, and zsh support is absolutely required, perhaps we can make two: |
IMHO only the changes I am proposing in the PR are needed to make it work on both bash and zsh. I have tested this for both shells and haven't noticed problems but if more testing is needed I am happy to do that. |
I don't see any issues - just saying that keeping script written in X working in Y is always going to be hard when X & Y aren't feature compatible. If we go with the PR as is, a comment might be useful so that future travellers know they should keep it compatible with zsh.
That shouldn't be an issue as every script that sources it is a bash script. The only issue here is that sourcing Alternatively, novarc can be modified to produce those variables and that can be sourced in any shell. Example:
|
When the novarc file is sourced from the Zsh, it fails due to a few Bash specifics: - $BASH_SOURCE - does not exist in Zsh - readarray - does not exist in Zsh Resolves issue canonical#176 Signed-off-by: Marcin Wilk <[email protected]>
Hi @pponnuvel I got your point about the need to maintain the script for both shells. I have added the comment as you suggested. |
Thanks @wilkmar . Yes, it makes sense to change the shebang in There's also one more in |
the |
Regardless, you can change the shebang in both. |
ACK but rather I will make it a separate PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Created PR #209 |
When the novarc file is sourced from the Zsh, it fails due to a few Bash specifics:
Resolves issue #176