In your example $1 contains a full hierarchial path name "put" defaults the "to filename" to be the same as the "from filename". Thus the full hierarchial filename is invalid on the destination system.
You need to strip the directory portion off the filename with a command such as "basename", then use both "lcd" an "cd" within the ftp script.
Something like this:
Starting process...
Using the following values:
Username: zzzz
Password: zzzz
Server: xxx.xxx.xxx.xxx
Wait time: 5 seconds
Remote Path: /Drop_off/Region_3_prod/EDI
Connecting to server...
Local Directory /home/user/Desktop/MMM...
Processing file EDEInmediataInboundClaims837.dat...
Local directory now /home/user/Desktop/MMM
Finihed procesing file EDEInmediataInboundClaims837.dat...
Seconds until next upload: 5
Procesing file number: 1
Connecting to server...
Local Directory /home/user/Desktop/MMM...
Processing file EDEInmediataInboundClaims837IEDIMMM20111117193200001v1-5010-50.dat...
Local directory now /home/user/Desktop/MMM
Finihed procesing file EDEInmediataInboundClaims837IEDIMMM20111117193200001v1-5010-50.dat...
Seconds until next upload: 5
Procesing file number: 2
Connecting to server...
Local Directory /home/user/Desktop/MMM...
Processing file EDEInmediataInboundClaims837IEDIPMC20111117194600001v1-5010-50.dat...
Local directory now /home/user/Desktop/MMM
Finihed procesing file EDEInmediataInboundClaims837IEDIPMC20111117194600001v1-5010-50.dat...
Seconds until next upload: 5
Procesing file number: 3
Connecting to server...
Local Directory /home/user/Desktop/MMM...
Processing file EDEInmediataInboundClaims837PEDIMMM20111117195600001v1-5010.dat...
Local directory now /home/user/Desktop/MMM
Finihed procesing file EDEInmediataInboundClaims837PEDIMMM20111117195600001v1-5010.dat...
Seconds until next upload: 5
Procesing file number: 4
Connecting to server...
Local Directory /home/user/Desktop/MMM...
Processing file EDEInmediataInboundClaims837PEDIPMC20111117194900001v1-5010-50.dat...
Local directory now /home/user/Desktop/MMM
Finihed procesing file EDEInmediataInboundClaims837PEDIPMC20111117194900001v1-5010-50.dat...
Seconds until next upload: 5
Procesing file number: 5
The below bash function uses multiple variables CODING, SAMPLE, SURVEY, andvariant
in it. The user selects the cap function and details are displayed on the screen using the $SURVEY variable, the directory is changed to $SAMPLE and the samples.txt is opened so the user can select the sample to... (6 Replies)
I am using simple for loop, but getting syntax error when I run the code
code
#!/bin/ksh
pls enter number
read n
for(i=1; i<=n; i++)
do
echo $i
done
syntax error
+ pls enter number
+ read n (5 Replies)
hi all ,
i just tried to take the status of previous command inside the script using
echo $?. It throws me a variable syntax error , but when i use echo $? as an individual command it works perfectly .
can anyone Please tell me why am getting a variable syntax error when i use echo $?... (7 Replies)
can some one please tell me what is the problem with my syntax:confused:
I have 100 files in one folder
1. want to read each of the line by line
2. calculate their number of the words between the first word and the last word of each line
3. create file for each file with number of words... (8 Replies)
I am trying to run a menu option though IF loops. I keep getting errors not allowed the menu to be processed correctly. Currently it will accept the first 2 statements but then crash on the 3rd. The 2nd and 3rd have the same syntax, so I do not understand why it breaks.
#!/bin/bash
while... (4 Replies)
Hello forum,
I hope my problem is easy to solve for someone in here!
My main task is to copy a large amount of imap-accounts from one server to another. There is a tool (Perl) called imapsync which does the job exellent. Unfortunately I'm only able to run it on one account at a time.
After... (3 Replies)
Hi
Can any one help, I'm trying to run a script that beeps out the ip address from the PC internal speaker with the following script. It keeps throwing the error "Syntax error: Bad for loop variable" on line 16. I know its picking up the IP ADDRESS correctly. Any ideas on whats wrong. I'm... (3 Replies)
I have a file called test.dat which contains
a b
I have written a shell script called test.sh
for i in `cat test.dat`
do
echo $i
done
When i run this script using
sh test.sh
I get this message -
test.sh: syntax error at line 6: `end of file' unexpected
What is the... (3 Replies)
Hello all,
I have "inherited" a Korn shell script I'm supposed to maintain, and running a "sh -n" on it, I got this syntax error:
script.sh: syntax error at line 63: `OB_DEVICE=$' unexpected
The line in cause is the first occurence of the usage of perl one-liners. The whole line:
... (2 Replies)
Hi,
I have the following script (compile_mercury) and I get this error: I have no idea why...and I have written this script completely in linux (bash) and not in windows.
****************
./compile_mercury: line 136: syntax error near unexpected token `done'
./compile_mercury: line 136:... (1 Reply)