其实直接
res=$(echo -e "abc\ndef") |
即可。但是输出时不能直接
echo $res |
这样只会输出
abc def |
正确做法是
echo "$res" |
abc |
其实直接
res=$(echo -e "abc\ndef") |
echo $res |
abc def |
正确做法是
echo "$res" |
abc |
Except as otherwise noted, this blog is licensed under CC BY-SA 4.0 License.
©2021-
searchstar
|
pv
|
uv
Theme Tree
by Wu Jun
Powered by Hexo