Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Search Forums:



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 09-03-2010
Registered User
 

Join Date: Sep 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Angry wput $1 variable - it's only guru question??

Hi at all.
I have a stupid question on a little script called "FSput.sh"

I try to upload multiple files:

abcdefg.rar
abcdefg.r00
abcdefg.r01
abcdefg.r02

whit:

Code:
WPUT $1 ftp://user:password@ftp.server.net/

insert in a bash script

When i try to call FSput.sh abcdefg.*

thats upload only first file (es: abcdefg.rar) and exit!!

Ok not work.. Then I tried a different script like:


Code:
#/bin/bash
FTPU="user" # ftp login name
FTPP="password" # ftp password
FTPS="ftp.server.net" # remote ftp server
FTPF="/" # remote ftp server directory for $FTPU & $FTPP
LOCALD="$"
find /home/transferftp/ -maxdepth 1 -type d | while read line
do
        d=$line
        f="${d}/$LOCALD"
        [ -f $f ] && ncftpput -m -u $FTPU -p $FTPP $FTPS $FTPF ${d}/$LOCALD
done

and try to use try to call FSput.sh abcdefg.*

nothing.. same result ulpoad first file (es: abcdefg.rar) and exit

Help me please!

Last edited by saltino; 09-04-2010 at 05:58 AM.. Reason: nobody reply ti post
Sponsored Links
    #2  
Old 09-06-2010
methyl methyl is offline Forum Staff  
Moderator
 

Join Date: Mar 2008
Posts: 5,652
Thanks: 205
Thanked 560 Times in 539 Posts
Can't comment on "ncftpput" syntax itself or whether you will move the files one-by-one or as a batch.

Within the script this line is suspect:
Quote:
LOCALD="$"
It probably should be:

Code:
LOCALD="$1"

And whenever the variable is referenced it should probably be quoted until the point when you want the "*" expanded. Though I can't see whether you want shell or ncftpput to expand the "*".

Code:
"${LOCALD}"

Sponsored Links
    #3  
Old 09-06-2010
ygemici ygemici is online now Forum Advisor  
sed_shell@LNU
 

Join Date: Feb 2010
Location: istanbul
Posts: 1,478
Thanks: 1
Thanked 247 Times in 240 Posts
if ok

Code:
# which lftp
/usr/bin/lftp

can use this

Code:
# lftp -u ftpuser,ftppasswd ftpserver <<EOF
mput abcdefg.r*
ls abcdefg.r*
quit
EOF

Sponsored Links
Closed Thread

Tags
wput ftpu ftpp ftps ftpf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
stupid ftp question tyiannak UNIX for Dummies Questions & Answers 2 02-28-2007 11:28 PM
stupid IP question sugarsweet IP Networking 3 05-20-2006 06:58 PM
sorry if this is a stupid question sskb UNIX for Dummies Questions & Answers 2 03-26-2002 03:17 AM
Stupid question... Cortney UNIX for Dummies Questions & Answers 6 12-06-2001 12:20 PM
Stupid Question? jskillet UNIX for Dummies Questions & Answers 9 04-26-2001 10:39 AM



All times are GMT -4. The time now is 04:09 AM.