shell指令用法

#* 和 %*

// 从abc后的所有内容
#*abc
// 从开头 直到abc的内容
%abc*
shell示例:
// 定义字符串
a="123abc456"
// 输出123abc456
echo $a
// 输出456
echo ${a#*abc}
// 输出123
echo ${a%abc*}

cat写入文件

cat <

cat < test.txt
abc
123
345
EOF

cat <<-EOF 解决 <

你可能感兴趣的:(shell指令用法)