我有一个bash脚本:错误:从bash脚本 “[参数太多”
#!/bin/bash
pathToTestCasesFile=$1
while IFS=';' read -r col1 col2
do
if [[ $col1 == V[0-9]:* ]]; then
echo "decrypt"
if [[ "$(decrypt "$col1")" == "$col2" ]] ; then
echo "$col1 is equal to $col2"
else
echo "$col1 is not equal to $col2"
fi
else
echo "encrypt"
if [[ "$(encrypt $col1)" == "$col2" ]] ; then
echo "$col1 is equal to $col2"
else
echo "$col1 is not equal to $col2"
fi
fi
done < $pathToTestCasesFile
exit 0
下面是测试文件:
alex;V1:IVjd9qcAbUrR954gyPDbKw==
V1:IVjd9qcAbUrR954gyPDbKw==;alex
输出看起来是这样的:
encrypt
alex is not equal to V1:IVjd9qcAbUrR954gyPDbKw==
decrypt
V1:IVjd9qcAbUrR954gyPDbKw== is not equal to alex
decrypt
但输出应该说一切都是平等的。
我确信在解密后的命令等于另一个命令的值。我单独测试了它。
也许有比较的问题..
非常感谢您的帮助。
该命令对我说第23行:$ pathToTestCasesFile:模棱两可的重定向。也许是$? –
好兄弟,你必须在pathToTestCasesFile加双引号变量 “$ pathToTestCasesFile:” –
从'/ automatedRegressionTest'文件内容 –