如何评论脚本中以下行的每一行?
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}
如果我尝试添加如下评论:
cat ${MYSQLDUMP} | \ # Output MYSQLDUMP File
我得到:
#: not found
可以在这里评论吗?
这会产生一些开销,但从技术上讲,它确实回答了您的问题:
echo abc `#Put your comment here` \ def `#Another chance for a comment` \ xyz, etc.
特别是对于管道,有一个没有开销的干净解决方案:
echo abc | # Normal comment OK here tr a-z A-Z | # Another normal comment OK here sort | # The pipelines are automatically continued uniq # Final comment