我是debian7.8 bash shell。
str="deb http://ftp.cn.debian.org/debian/ wheezy main contrib non-free \n
deb-src http://ftp.cn.debian.org/debian/ wheezy main contrib non-free "
echo $str > test
在我的测试文件中是:
deb http://ftp.cn.debian.org/debian/ wheezy main contrib non-free \n deb-src http://ftp.cn.debian.org/debian/ wheezy main contrib non-free
我想要的是:
deb http://ftp.cn.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ wheezy main contrib non-free
如何正确表达换行符?
还是
—
drewbenn
echo -e
...
\n
并引用您的变量 ...