diff --git a/libexec/rbenv-init b/libexec/rbenv-init index acc9e40..ae2da55 100755 --- a/libexec/rbenv-init +++ b/libexec/rbenv-init @@ -71,10 +71,10 @@ if [ -z "$print" ]; then echo case "$shell" in fish ) - echo 'status --is-interactive; and rbenv init - | source' + echo 'status --is-interactive; and rbenv init - fish | source' ;; * ) - echo 'eval "$(rbenv init -)"' + printf 'eval "$(rbenv init - %s)"\n' "$shell" ;; esac echo diff --git a/test/init.bats b/test/init.bats index d3548f0..63fc8c6 100755 --- a/test/init.bats +++ b/test/init.bats @@ -51,10 +51,16 @@ OUT [ -z "$line" ] || flunk "did not expect line: $line" } +@test "posix shell instructions" { + run rbenv-init bash + assert [ "$status" -eq 1 ] + assert_line 'eval "$(rbenv init - bash)"' +} + @test "fish instructions" { run rbenv-init fish assert [ "$status" -eq 1 ] - assert_line 'status --is-interactive; and rbenv init - | source' + assert_line 'status --is-interactive; and rbenv init - fish | source' } @test "option to skip rehash" {