Sponsored Content
Full Discussion: FTP script variable issue
Top Forums Shell Programming and Scripting FTP script variable issue Post 302629381 by sonu_pal on Tuesday 24th of April 2012 02:47:51 PM
Old 04-24-2012
Hi ,

I am using the below complete code:
Code:
INPUTFILE_1=ADDR3.ALL
INPUTFILE_2="PCPSWAB1.UNDELV.DWNL.TRILL(+1)"
FTP_FILE_1=NVS.DWG.P.GBRSWUDL.ADDR3
FTP_FILE_2=PCPSWAB1.UNDELV.DWNL.TRILL-900-TEXT.u
ftp_mode="ascii"
target_dir_1=".."
target_dir_2="trillium"
count=2
LOGFILE=/srv/udl/logs/udl_ftp2fti.log

UDL_FTIHOST_1=podftiapp02.com
UDL_FTIUSER_1=dbsunny
UDL_FTIPWD_1=sunny@11
UDL_FTIHOST_2=podftiapp01.com
UDL_FTIUSER_2=dbamy
UDL_FTIPWD_2=amy@12

count=2

i=1
while [ $i -le $count ]
do
 

FTIHOST=$(echo UDL_FTIHOST_${i})
FTIUSER=$(echo UDL_FTIUSER_${i})
FTIPWD=$(echo UDL_FTIPWD_${i})
target_dir=$(echo target_dir_${i})
FTP_FILE=$(echo FTP_FILE_${i})
INPUTFILE=$(echo INPUTFILE_${i})


echo "Connecting to FTP server to send UDL file...."
ftp -n -v ${FTIHOST} <<EOF > ${LOGFILE}

lcd ${FILE_DIR}
cd ${target_dir}
user ${FTIUSER} ${FTIPWD}
type ${ftp_mode}
put ${INPUT_FILE} ${FTP_FILE}
EOF

i=`expr $i + 1`
echo "--------------------------------------------------------------"
done >> ${LOGFILE}

Can you let me know how can we implement it thorugh array or using shell function..

thanks for your advice.

sonu
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Unix Shell script FTP Issue

Hi All We have a number of FTP Shell scripts running every day on a scheduled basis. The issue we have is if the host connection is not available after a little while ftp times out and the script hangs as the shell returns to the ftp> prompt waiting for input from a user. Any ideas how... (2 Replies)
Discussion started by: mlucas
2 Replies

2. UNIX for Dummies Questions & Answers

passing ip address as a variable to script for ftp

Still a Beginner here .. Does anyone no how to get the IP address of the machine thats logged in (bearing in mind there will be others logged in) while they are logged in to the Unix server and pass this as a variable to a shell script so as I can FTP files to that machine via a shell script, at... (2 Replies)
Discussion started by: Gerry405
2 Replies

3. Shell Programming and Scripting

please help ftp script issue

hi, I have ftp script where the user name has "\" in it and my script unable to detect it....here is what I am doing... `ftp -vin <<- FTP >> log.txt 2>&1 user ibm\user password FTP` my log says.. user ibmuser not found... please help..... (4 Replies)
Discussion started by: mgirinath
4 Replies

4. Shell Programming and Scripting

Performance issue with ftp script.

Hi All, I have written a script to FTP files from local server to remote server. When i try it for few number of files the scripts runs successfully. But the same script when i run for 200-300 files it gives me performanace issue by aborting the connection. Please help me out to improve the... (7 Replies)
Discussion started by: Shiv@jad
7 Replies

5. UNIX for Advanced & Expert Users

FTP-Shell Script-Performance issue

Hello All, Request any one of Unix/Linux masters to clarify on the below. How far it is feasible to open a new ftp connection for transferring each file when there are multiple files to be sent. I have developed shell script to send all files at single stretch but some how it doesnt suit to... (3 Replies)
Discussion started by: RSC1985
3 Replies

6. Shell Programming and Scripting

using a variable within ftp shell script

hi all i have a problem. i have a file called 20091015_extract.csv in my shell script i set the following variable: TODAY=`date +%Y%m%d` when i start an ftp session (within my shell script) I want to transfer the file like this: put $TODAY_extract.csv however, ftp is not... (2 Replies)
Discussion started by: soliberus
2 Replies

7. Shell Programming and Scripting

How to pass variable to ftp script?

how can I use shell variable inside ftp script as in below:- the case as below:- I have folder names as (Sunday,Monday...etc) and inside these folders I am trying to get files where their names are "mf_usm_ssnc*_mo0'HOUR''MIN'". where HOUR= hour as in `date "+%H"` - 2 MIN= either... (2 Replies)
Discussion started by: ahmad.diab
2 Replies

8. Shell Programming and Scripting

variable issue in a bash in a shell script

Hi, I am trying to write a PBS shell script that launches a bash process. The issue is that the bash process needs a variable in it and the shell script is interpreting the variable. How do I pass this as a literal string? Here is my code snippit: TMP=".fasta" FILEOUT=$FILE$TMP cd... (2 Replies)
Discussion started by: bioBob
2 Replies

9. Shell Programming and Scripting

FTP command issue in shell script

Hi All I am using following code in my shell script to send the file to a mainframe server. ftp -in $FTP_IP_SEND <<END_OF_FTP >$LOG_DIR/ProviderExportFTP.log quote user $FTP_USER_SEND quote pass $FTP_PASS_SEND ascii send ./ProviderExport.txt 'PROJ.PDRCACTS.FD87050.EXPORT' (REPLACE... (3 Replies)
Discussion started by: Renjith180282
3 Replies

10. Shell Programming and Scripting

Issue with the shell script after storing the directory in a variable

FTP is connecting to the server but i am getting an error - Enter if the env is dev or test or prod: test Please enter the id no : xxxxxxx Connected to xxxx 220 (vsFTPd 2.2.2) 331 Please specify the password. 230 Login successful. ?Invalid command ?Invalid command ?Invalid command... (3 Replies)
Discussion started by: chandraprakash
3 Replies
echo(3XCURSES)						  X/Open Curses Library Functions					    echo(3XCURSES)

NAME
echo, noecho - enable/disable terminal echo SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib -R /usr/xpg4/lib -lcurses [ library... ] c89 [ flag... ] file... -lcurses [ library... ] #include <curses.h> int echo(void); int noecho(void); DESCRIPTION
The echo() function enables Echo mode for the current screen. The noecho() function disables Echo mode for the current screen. Initially, curses software echo mode is enabled and hardware echo mode of the tty driver is disabled. The echo() and noecho() functions control soft- ware echo only. Hardware echo must remain disabled for the duration of the application, else the behavior is undefined. RETURN VALUES
Upon successful completion, these functions return OK. Otherwise, they return ERR. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
getch(3XCURSES), getstr(3XCURSES), initscr(3XCURSES), libcurses(3XCURSES), scanw(3XCURSES), attributes(5), standards(5) SunOS 5.10 5 Jun 2002 echo(3XCURSES)
All times are GMT -4. The time now is 04:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy