Linux bash write long string with multilines All In One

Linux bash write long string with multi-lines All In One

demo

MARKDOWN='
{
    "msgtype": "markdown",
    "markdown": {
        "content": "⏰ '$SH_DATE'\n\n<font color=\"warning\">读书会快捷链接</font>\n\n[<font color=\"info\">阅读打卡链接</font>](https://library.xgqfrms.xyz/#/club/share)\n\n‍[<font color=\"info\">我的链接</font>](https://library.xgqfrms.xyz/#/my)\n\n[<font color=\"info\">积分链接</font>](https://library.xgqfrms.xyz/#/mall)\n\n<font color=\"warning\">读书会机器人️ features:</font>\n\n<font color=\"comment\">1. 大大简化进入打卡的流程,跳过 3s 首页的推荐;</font>\n\n<font color=\"comment\">2. 每天早晚两次打卡提醒(08:00 和 20:00) ⏰,降低忘记打卡的风险;</font>\n\n",
        "mentioned_list":["Eric"],
    }
}'


solutions

EOL / EOM



js template string

const markdown = `
⏰ '$SH_DATE'\n\n
<font color=\"warning\">读书会快捷链接</font>\n\n
[<font color=\"info\">阅读打卡链接</font>](https://library.xgqfrms.xyz/#/club/share)\n\n
‍[<font color=\"info\">我的链接</font>](https://library.xgqfrms.xyz/#/my)\n\n
[<font color=\"info\">积分链接</font>](https://library.xgqfrms.xyz/#/mall)\n\n
<font color=\"warning\">读书会机器人️ features:</font>\n\n
<font color=\"comment\">1. 大大简化进入打卡的流程,跳过 3s 首页的推荐;</font>\n\n
<font color=\"comment\">2. 每天早晚两次打卡提醒(08:00 和 20:00) ⏰,降低忘记打卡的风险;</font>\n\n",
`;

refs

https://stackoverflow.com/questions/7316107/how-to-split-strings-over-multiple-lines-in-bash

https://unix.stackexchange.com/questions/503572/how-to-break-a-long-string-into-multiple-lines-assigned-to-a-variable-in-linux-b

https://serverfault.com/questions/72476/clean-way-to-write-complex-multi-line-string-to-a-variable



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 ️,侵权必究⚠️!


原文地址:https://www.cnblogs.com/xgqfrms/p/15697376.html