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(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.11 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 12:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy