I am trying to append eval "$(rbenv init -)"
to my bash profile
(I am trying to follow this instruction)
# Load rbenv automatically by appending
# the following to ~/.bash_profile:
eval "$(rbenv init -)"
This is part of an automated process so I don't have access to a GUI or can't use an editor. but when I echo the command $(rbenv init -) gets executed and append bunch of stuff. How can I echo it as plain text?
this is what I have now
ec2-user@ip-172-31-46-129 ~ % cat /tmp/install-rbenv.sh
+-zsh:41> cat /tmp/install-rbenv.sh
#!/bin/bash
sudo -i -u buildkite-agent bash << EOF
echo "export RUBY_CONFIGURE_OPTS=\"--with-openssl-dir=$(brew --prefix openssl@1.1)\"" >> /Users/buildkite-agent/.bash_profile
echo 'eval "$(rbenv init -)"' >> /Users/buildkite-agent/.bash_profile
EOF
echo "Done"
running it
ec2-user@ip-172-31-46-129 ~ % . /tmp/install-rbenv.sh
+-zsh:42> . /tmp/install-rbenv.sh
+/tmp/install-rbenv.sh:6> brew --prefix openssl@1.1
+/tmp/install-rbenv.sh:6> rbenv init -
+/tmp/install-rbenv.sh:6> sudo -i -u buildkite-agent bash
+/tmp/install-rbenv.sh:10> echo Done
Done
checking the bash profile
ec2-user@ip-172-31-46-129 ~ % sudo su - buildkite-agent
+-zsh:43> sudo su - buildkite-agent
rbenv: no such command `sh-'
-bash: eval: line 31: syntax error near unexpected token `rehash'
-bash: eval: line 31: ` rehash|shell)'
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
ip-172-31-46-129:~ buildkite-agent$ cat ~/.bash_profile
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl@1.1"
eval "export PATH="/Users/ec2-user/.rbenv/shims:${PATH}"
export RBENV_SHELL=zsh
source /usr/local/Cellar/rbenv/1.1.2/libexec/../completions/rbenv.zsh
command rbenv rehash 2>/dev/null
rbenv() {
local command
command="${1:-}"
if [ "$#" -gt 0 ]; then
shift
fi
case "$command" in
rehash|shell)
eval "$(rbenv "sh-$command" "$@")";;
*)
command rbenv "$command" "$@";;
esac
}"