我在使用脚本时遇到了问题。我的目标是,根据运行时输入的整数值,迭代执行文件转换并分割一定次数,最后完成操作。但我预见到一个问题,就是在脚本的 while 循环部分中,将会比较字符串而不是整数。以下是部分代码:
GTF="$1"
SP=$(dirname "$SCRIPT")
echo "Welcome to this script, Please do me a favor and enter the dimensions of the original Geographical Tiff file so I do not crash myself!!"
# Read the x axis max and y axis max so we do not have any errors.
echo "X axis -> "
read XMAX
echo "Y axis -> "
read YMAX
脚本中的XMAX和YMAX值需要是整数,才能按照预期工作。有没有什么解决方案?
谢谢!