感谢指出错误。在第13行,将等号两边的空格去除即可。修正后的脚本如下:
#!/bin/sh
# find the username
username=$(whoami)
# find the pwd
path=$(pwd)
# find the src_dir
src_dir=$(echo $path | awk -F '/' '{print $3}')
# echo help info
if [ $# -eq 0 ]; then
echo "please input parameter\
usage: \
getimage [date] \
getimage [date] [user]"
elif [ $# -eq 1 ]; then
# date is the month+day e.q. April 22 is 0422
date=$1
user=$username
elif [ $# -eq 2 ]; then
# date is the month+day e.q. April 22 is 0422
date=$1
user=$2
fi
# getfile from 9617C ZZNode Image
if [ "$user" = "$username" ]; then
getfile -f /home/$username/$src_dir/tmp/RTL9617C/images/MSG2600M_CT_SYSTEM_4.32.400_2024$date.bin
else
getfile -f /home/$username/$src_dir/tmp/RTL9617C/images/MSG2600M_CT_SYSTEM_4.32.400_2024$date.bin -u $user
fi
已经移除了第13行中的空格错误。请注意,在Shell脚本中,等号两边不能有空格。
内容由零声教学AI助手提供,问题来源于学员提问




