简体   繁体   English

如何在 bash 中回显文字 output

[英]How to echo literal output in bash

I would like to "copy-paste" the following lines in a script into my bashrc :我想将脚本中的以下几行“复制粘贴”到我的bashrc中:

# VIM,TMUX stuff
VIM="$(which vim)"

For example:例如:

echo "# VIM,TMUX stuff" >> ~/.bash_profile
echo 'VIM="$(which vim)"' >> ~/.bash_profile

However, it seems to 'escape' some of the items.但是,它似乎“逃脱”了某些项目。 How would I do the equivalent of a literal 'copy-paste' as I'm trying to do above?我将如何做相当于我在上面尝试做的文字“复制粘贴”?

Use heredoc in bash :在 bash 中使用 heredoc

cat <<-'EOF' > ~/.bash_profile
# VIM,TMUX stuff
VIM="$(which vim)"
EOF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM