我的程序接受了用户的2个参数
echo "Enter First code :"; read code_1
echo "Enter Second code :"; read code_2
我运行test.ksh并提示用户输入。
说用户输入1和2
Enter First code : 1
Enter Second code : 2
现在无需编辑test.ksh,我如何映射在命令行中传递的参数以读取Shell脚本中的语句?
test.ksh 1 2
Enter First code : 1
Enter Second code : 2
您不;您可以将这些值写入脚本标准输入中。
printf '1\n2\n' | test.ksh