相关疑难解决方法(0)

如何为多行命令添加行注释

我知道如何在Bash脚本中编写多行命令,但是如何在多行命令中为每一行添加注释?

CommandName InputFiles      \ # This is the comment for the 1st line
            --option1 arg1  \ # This is the comment for the 2nd line
            --option2 arg2    # This is the comment for the 3nd line
Run Code Online (Sandbox Code Playgroud)

但不幸的是,继续角色之后的评论\将打破命令.

bash shell comments

303
推荐指数
4
解决办法
6万
查看次数

评论Bash脚本

如何从脚本中评论以下几行的每一行?

cat ${MYSQLDUMP} | \
sed '1d' | \
tr ",;" "\n" | \
sed -e 's/[asbi]:[0-9]*[:]*//g' -e '/^[{}]/d' -e 's/""//g' -e '/^"{/d' | \
sed -n -e '/^"/p' -e '/^print_value$/,/^option_id$/p' | \
sed -e '/^option_id/d' -e '/^print_value/d' -e 's/^"\(.*\)"$/\1/' | \
tr "\n" "," | \
sed -e 's/,\([0-9]*-[0-9]*-[0-9]*\)/\n\1/g' -e 's/,$//' | \
sed -e 's/^/"/g' -e 's/$/"/g' -e 's/,/","/g' >> ${CSV}
Run Code Online (Sandbox Code Playgroud)

如果我尝试添加评论说" cat $ {MYSQLDUMP} |\#Output MYSQLDUMP File ",我得到:

删除:未找到

是否有可能在这里发表评论,因为" __CODE__"?

syntax bash comments

152
推荐指数
6
解决办法
32万
查看次数

标签 统计

bash ×2

comments ×2

shell ×1

syntax ×1