new line in bash parameter substitution ${REV%%\n*}

前端 未结 3 1550
你的背包
你的背包 2021-02-08 22:47

does not work

echo ${REV%%\\n*}

does work

echo ${REV%%
*}

After reading trough http://tldp.org/LDP/abs/html/p

3条回答
  •  北荒
    北荒 (楼主)
    2021-02-08 23:20

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

提交回复
热议问题