【发布时间】:2017-01-30 16:21:42
【问题描述】:
我正在尝试将标志和变量都存储到脚本中。对于 SFTP,我需要 -s 和输出文件的 -o 之类的东西。我正在尝试将这些存储到变量中以供以后使用。用法是 Script.ksh -o test.txt。输出应该是
output file is: test.txt
sftpFlag=Y
脚本内容如下,
args=`getopt -o:-i:-e:-s "$@"`
for arg in $args
do
case "$arg" in
o)output=$arg;;
s)sftpFlag=Y
esac
done
echo "output file is: "$output
echo "SFTP flag is: "$sftpFlag
【问题讨论】: