mirror of
https://github.com/rbenv/rbenv.git
synced 2024-12-29 13:15:42 +01:00
fix rbenv()
function in ksh and dash
ksh syntax becomes: function rbenv { typeset command `typeset` only declares a local variable if there's an explicit `function` declaration; otherwise the variable leaks. Other shells use this syntax: rbenv() { local command This is for dash compatibility, which supports neither `function` nor `typeset`. references #205, fixes #408
This commit is contained in:
parent
31fab8cdae
commit
5ae2cac088
1 changed files with 14 additions and 4 deletions
|
@ -122,13 +122,25 @@ function rbenv
|
|||
command rbenv "\$command" \$argv
|
||||
end
|
||||
end
|
||||
EOS
|
||||
exit 0
|
||||
;;
|
||||
ksh )
|
||||
cat <<EOS
|
||||
function rbenv {
|
||||
typeset command
|
||||
EOS
|
||||
;;
|
||||
* )
|
||||
IFS="|"
|
||||
cat <<EOS
|
||||
rbenv() {
|
||||
typeset command
|
||||
local command
|
||||
EOS
|
||||
;;
|
||||
esac
|
||||
|
||||
IFS="|"
|
||||
cat <<EOS
|
||||
command="\$1"
|
||||
if [ "\$#" -gt 0 ]; then
|
||||
shift
|
||||
|
@ -142,5 +154,3 @@ rbenv() {
|
|||
esac
|
||||
}
|
||||
EOS
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in a new issue