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

前端 未结 3 881
忘掉有多难
忘掉有多难 2021-02-08 22:40

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:31

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

提交回复
热议问题