-
Notifications
You must be signed in to change notification settings - Fork 15
Support zsh in call_host.sh
#42
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
base: master
Are you sure you want to change the base?
Conversation
…NCNAME[1]) instead of the helper's own name.
|
@clelange thanks for this contribution! tagging @NJManganelli here because he had also expressed interest in zsh support. I won't have time to review this in depth until next week, but I wanted to acknowledge receipt. |
|
In the meantime, you can try to placate shellcheck... |
|
I had hacked together a minimal translation and had no time to clean it up, but even at a glance this is better and more functional. I can hopefully test it as a replacement for my hacked version later |
This should be OK now. |
| } | ||
| # declare an associative array (zsh) - create a named array using eval so dynamic name works | ||
| declare_assoc(){ | ||
| eval "typeset -A $1" |
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.
check if eval necessary here
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.
As far as I know, in zsh, typeset -A $1 would try to create an array literally named $1.
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.
If I just enter /bin/zsh, the following works as the similar test did above for bash:
TEST1=TEST2
typeset -A $TEST1
TEST2[foo]=bar
echo "${TEST2[@]}"output:
bar
|
Thanks for the careful review. I'm not sure I'll be able to address everything this week, but if not, I'll pick this up in the second half of next week. |
|
@clelange just checking on this |
|
Hey, yes, it's on my list but I haven't managed to get back to it yet. |
|
I hope I have managed to address all suggestions @kpedro88 |
|
@clelange everything looks good except the one remaining |
I'm using zsh for most of my work, which is currently not supported by the
call_host.shscript. I've made it work by identifying the bash-specific parts and changing those to functions. I've also introduced a function to identify if zsh is used and another one to prevent duplicating the bind paths when accidentally sourcing thecall_host.shscript more than once.