shell脚本入门

1.for循环

1.txt中的内容:

z3
l4
w5

循环打印该文档中的内容:

for name in `cat 1.txt`; 
do 
echo $name ;
done

2.if语句

if [[ $3 = "t" ]]; then 
echo "success!"
fi

参考文献

[1] Shell循环语句详解–for循环
[2] [shell脚本报错:“[: =: unary operator expected“解决办法(https://blog.csdn.net/weixin_42891455/article/details/121339338)

你可能感兴趣的:(shell)