Hello again.
I've gotten most of my script working; however I am getting the following error:
Code:
Couldnt get a file descriptor referring to the console
I would very much appreciate any assistance in understanding what I am doing wrong, I searched the interwebz to no avail, so now I am appealing to you wonderful, intelligent, helpful people once again.
Here is the script:
Code:
#!/bin/bash -xvd
host=$1
user=$2
pass=$3
dir=$4
company=$5
quser=$6
qpass=$7
qhost=$8
qdbase=$9
declare -a myarray
let count=0
#Query
myarray=($(mysql -N -u$quser -p$qpass -h$qhost -D$qdbase -e "SELECT id FROM table;"))
#start FTP
for id in ${myarray[@]}
do
ftp -n 2>&1
open $host << ENDFTP
{
print user $user $pass
print mkdir $dir
print cd $dir
print binary
print mput /dir/to/${id}/
print echo " » <b>${id}</b><br />"
print quit
}
ENDFTP
done
exit 0
The query just pulls the ID out, which has folders named after the ID and we're FTPing over the folder. I get that error before it even makes it to the mkdir. It might not even be getting to the here; but I'm not 100% sure.