The passwords have been removed for obvious reasons.
The fucntion works now! I couldn’t figure out how to force the user to input a number for the second argument but I figured out a work-around to force the user to input two arguments. If they don’t it will present a message telling them what they need to do. I also had to add a bogus option (xyzpdq) in front of the user names in the “case” section. For some reason the script ignores whatever is in the first position.
sendtoftp() {
if [ $# -ne 2 ]
then
echo
echo “————————————–”
echo “| Example: sendtoftp ban11 09122010 |”
echo “————————————–”
echo
elsecase $1 in
ban11)
HOST=10.65.48.199
USER=ban11
PASSWD=xxxxxxexec 4>&1
ftp -nv >&4 2>&4 |&print -p open $HOST
print -p user $USER $PASSWD
#print -p cd directory
#print -p binary
print -p prompt
print -p ascii
print -p mput ban11*$2*
print -p byewait
exit 0
;;
@xyzpdq | ban02 | ban03 | ban04 | ban05 | ban06 | ban07 | ban08 | ban09 | ban10 | ban12 | ban13 | ban14 | ban15 | ban16 | ban17 | ban18 | ban19 | ban20 | ban20 | ban21)HOST=10.65.48.199
USER=$1
PASSWD=xxxxxxxexec 4>&1
ftp -nv >&4 2>&4 |&print -p open $HOST
print -p user $USER $PASSWD
#print -p cd directory
##print -p binary
print -p prompt
print -p ascii
print -p mput $1*$2*
print -p byewait
exit 0
;;
*)
Message=”Usage: sendtoftp username date.”
Message1=”Example: sendtoftp ban12 09012010.”
echo ” ”
echo ” ”
echo $Message ” “$Message1
echo ” ”
echo ” ”
;;
esac
fi
}