Skip to content

Fix for zsh issue #222

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions kvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,9 @@ kvm()
fi
echo ""

local arr=()
local i=0
local arr
arr=()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird must be some github thing. If you see the entire file it is indented correctly

local i=1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are zsh arrays 1-indexed? This will break in bash because the arrays are 0-indexed there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--Actually, it might not break but you will have an empty first element and this could cause weird bugs later when people are not aware of that--

Scratch that. It might break because of the foreach loop that follows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure I tested this out in both bash and zsh. It works without issues. This PR is actually merged in the kvm repo. I am porting the fix

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay... I'm a little surprised it works :) :shipit: then

local format="%-20s %s\n"
for _kvm_file in $(find "$KRE_USER_HOME/alias" -name *.alias); do
arr[$i]="$(basename $_kvm_file | sed 's/.alias//')/$(cat $_kvm_file)"
Expand Down