对于以下shell脚本-
#!/bin/sh
main_version=0
feature_version=0
patch_version=0
if [[ $1 -eq "m" ]]; then
main_version=$((main_version+1))
fi
if [[ $1 -eq "f" ]]; then
feature_version=$((feature_version+1))
fi
if [[ $1 -eq "p" ]]; then
patch_version=$((patch_version+1))
fi
echo $main_version
echo $feature_version
echo $patch_version
即使我m
使用参数传递,它也会增加所有变量./<script-name>.sh m
是什么原因呢?