bash cat
how to translate variables as necessary when using cat?
man bash it says under Here Documents
Unquote EOF
cat >> ~/.zshrc << EOF
if [ -d ~/bin ]; then
PATH=$PATH:~/bin
fi
EOF
output:
eval "$(/opt/homebrew/bin/brew shellenv)"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if [ -d ~/bin ]; then
PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/apache-maven-3.6.3/bin:~/bin
fi
Quote EOF
cat >> ~/.zshrc << 'EOF'
if [ -d ~/bin ]; then
PATH=$PATH:~/bin
fi
EOF
output:
eval "$(/opt/homebrew/bin/brew shellenv)"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if [ -d ~/bin ]; then
PATH=$PATH:~/bin
fi