如何在不使用 Enter 或 Return 的情况下粘贴文本或代码

How to paste a text or code without Enter or Return

我在尝试通过按 ctrl[将代码或文本粘贴到 windows 7 中的 git bash 中时遇到问题 + shift + insert 它正在粘贴代码,但使用 Enter 或 return 操作界面!

所以我想做的就是:

$ echo "Code with break lines" >> index.html

我想在不打开编辑器的情况下使用(echo 命令)将以上代码插入 index.html 文件。

鼠标中键也给出相同的结果:(

有什么帮助吗??

您可以使用 cat 命令在 bash 中插入 <<,如下所示:

cat << EOF > index.html
// Insert your copy here
EOF

它会捕获所有内容,甚至你的换行符 more information about <<

<< 旁边的单词意味着它将读取所有内容作为用户输入,直到它在这种情况下找到指定的单词 EOF,但如果您愿意,可以使用其他单词。