You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
This approach is not restricted to >= 5.0, which will probably be a huge deal to some people looking to write more portably. It works in >= 3.1. Tested in all full releases of BASH from 3.0 to 5.1.8.
reverse_array() {
local Buffer=("$@")
for(( Index =$#-1; Index >=0; Index--)); {
printf'%s\n'"${Buffer[Index]}"
}
}
The only reason it didn't work in BASH 3.0 and 3.0.16 was because of the local builtin — perhaps an old bug or limitation later addressed.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
https://github.com/dylanaraps/pure-bash-bible#reverse-an-array
This approach is not restricted to >= 5.0, which will probably be a huge deal to some people looking to write more portably. It works in >= 3.1. Tested in all full releases of BASH from 3.0 to 5.1.8.
The only reason it didn't work in BASH 3.0 and 3.0.16 was because of the
local
builtin — perhaps an old bug or limitation later addressed.The text was updated successfully, but these errors were encountered: