凯撒代码解码 Bash

学校项目 Bash脚本 创建凯撒移位脚本保存结果到输出文件 → 用解码脚本解码输出文件
./decode a_file_full_of_text
现有代码 转换input到文件

#!/bin/bash

-u 1 translate upper letter

-u 0 translate lower letter

index=99999;
choose=0;

while [[ $# -gt 0 ]]; do
case $1 in
-n)
shift
index=$1
;;
-u)
shift
choose=1
;;
esac
shift
done

if [[ $choose -eq 0 ]]; then
read stringLow
elif [[ $choose -eq 1 ]]; then
read stringHigh
fi

if [[ $choose -eq 0 ]]; then
echo ${stringLow:0:$index} | tr '[a-z]' '[c-za-b]'
elif [[ $choose -eq 1 ]]; then
echo ${stringHigh:0:$index} | tr '[A-Z]' '[C-ZA-B]'
fi