Bash 脚本批处理模板

· · 个人记录

Usage: bash *.sh / ./*.sh

set -e

echo "How to use Bash" > a.txt
cat a.txt > b.txt
# echo "How to use Bash?" > a.txt
diff a.txt b.txt -w -q  

for i in *.in
do
j="${i%.in}.out"
if [ -e $j ]; then echo $i $j; fi
done

for i in {1..10} 100 102
do
echo $i
done