且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

bash参数替换$ {REV %% \ n *}中的新行

更新时间:2023-12-04 10:51:58

$ {REV %% $'\ n *'} 似乎有效.参见 bash文档的引用部分.>

does not work

echo ${REV%%\n*}

does work

echo ${REV%%
*}

After reading trough http://tldp.org/LDP/abs/html/parameter-substitution.html I still can not figure out how to make \n work.

${REV%%$'\n*'} seems to work. See the quoting section of the bash documentation.