mirror of
https://github.com/rbenv/rbenv.git
synced 2025-01-01 14:45:03 +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
|
command rbenv "\$command" \$argv
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
EOS
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
ksh )
|
||||||
|
cat <<EOS
|
||||||
|
function rbenv {
|
||||||
|
typeset command
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
IFS="|"
|
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
rbenv() {
|
rbenv() {
|
||||||
typeset command
|
local command
|
||||||
|
EOS
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
IFS="|"
|
||||||
|
cat <<EOS
|
||||||
command="\$1"
|
command="\$1"
|
||||||
if [ "\$#" -gt 0 ]; then
|
if [ "\$#" -gt 0 ]; then
|
||||||
shift
|
shift
|
||||||
|
@ -142,5 +154,3 @@ rbenv() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
Loading…
Reference in a new issue