Linux bash shell script block comment All In One
Linux bash shell script block comment All In One
Linux bash shell 脚本 多行注释 / 块级注释
Linux bash shell 脚本 多行注释 / 块级注释
# :后面有空格 ✅
: <<EOF
# codes ...
...
# whatever ...
EOF
# :后面无空格 ✅
:<<EOF
# codes ...
...
# whatever ...
EOF
# :<<'block_comment'
:<<'END'
END
# block_comment
:<<UFO
# codes ...
...
# whatever ...
UFO
# 双引号 ✅
:<<"BC"
# codes ...
...
# whatever ...
BC
# 单引号 ✅
:<<'BC'
# codes ...
...
# whatever ...
BC
# 无引号 ✅
:<<BC
# codes ...
...
# whatever ...
BC
# emoji ✅
:<<🇨🇳
# codes ...
...
# whatever ...
🇨🇳
demos
#!/usr/bin/env bash
echo "Line 1"
# linux bash block comment
# :<<'block_comment'
:<<'END'
n=0
b=10
a=1
while read line
do
n=`expr $n + $a`
if [ $n == $b ]
then
echo $line
fi
done < file.txt
END
# block_comment
echo "Line end ✅"
sed
/ head / tail
sed -n 10p ./text.txt
sed -n '10p' ./text.txt
# cat ./text.txt | head -n +10p ❌
cat ./text.txt | head -n +10
cat ./text.txt | head -n 10
cat ./text.txt | head -n +10 | tail -n 1
# cat ./text.txt | head -n 10 | tail -n 1 ❌
# cat ./text.txt | tail -n 10p ❌
cat ./text.txt | tail -n +10
cat ./text.txt | tail -n 10
cat ./text.txt | tail -n +10 | head -n 1
cat ./text.txt | tail -n 10 | head -n 1
# cat ./text.txt | tail -n '10p' | head -n 1 ❌
Linux bash REPL
https://www.lintcode.com/problem/2656/description
(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!
refs
https://stackoverflow.com/questions/947897/block-comments-in-a-shell-script
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/16375588.html
未经授权禁止转载,违者必究!