FTP script in ksh88


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP script in ksh88
# 1  
Old 07-05-2013
FTP script in ksh88

Hi I tried the following code to FTP the files from test server to dev
Code:
#!/bin/ksh
DST=/home/files
 cd $DST
ftp -inv 'test_serv101' << EOF
quote USER test
quote PASS test
# File Path on test server
cd /etc/home/Or_Files
ascii
mget curMonth* $DST
quit
EOF

when i try the above code it is successfully loading the required files into specified path
But the issue is i'm getting the followig output for each file.
Code:
local: curMonthApr_file3 remote: curMonthApr_file3
187653 bytes received in 0.12 seconds (1457.71 Kbytes/s)
 PORT command successful.
 Opening ASCII mode data connection for curMonthApr_file3 (2923959 bytes).
 Transfer complete.

How to avoid the above kind of output when i execute the script .
Thank You
# 2  
Old 07-05-2013
What is the purpose of the script ? for batch? If so redirect the output to /dev/null...
# 3  
Old 07-05-2013
The purpose of the script is to just download files from test server to dev server.

I tried using >/dev/null like below .
Code:
ftp -inv 'test_serv101'  >/dev/null

The system got hanged when i used like above

Code:
ftp -inv 'test_serv101' << EOF  >/dev/null

Command not found err

Code:
mget curMonth* $DST >/dev/null

When i used like above , i'm getting output for each and every file in the terminal

Please suggest me .
# 4  
Old 07-05-2013
you are in interactive mode, ftp wants to announce to you since you are looking (STDOUT) what it has done...
To avoid announcements:
You write a script like:
Code:
#!/bin/ksh
myftpscript >/dev/null 2>&1

Make it executable and run it, are you happy? but now how do you know if it did anything...
The wise would be to redirect in a log file, so you can go and check...
# 5  
Old 07-07-2013
FTP automatipn with Ksh

Hi , Below script can help for the FTP Automation

*****************************************
Code:
#! /usr/bin/ksh
HOST=Enter_FTP_Server_IP_Here
USER=Enter_FTP_Server_Username_Here
PASSWD=Enter_FTP_Server_Password_Here
exec 4>&1
ftp -nv >&4 2>&4 |&
print -p open $HOST
print -p user $USER $PASSWD
#print -p cd directory
print -p binary
print -p ls 
print -p bye
wait
exit 0

****************************************

Regards,
Goksel Yangin
Computer Engineer

---------- Post updated at 07:28 AM ---------- Previous update was at 07:24 AM ----------

This can help for telnet automation

Code:
#! /usr/bin/ksh
HOST=$1
USER=Enter_Username_Here
PASSWD=Enter_Password_Here

exec 4>&1
telnet  >&4 2>&4 |&

print -p open $HOST
sleep 3
print -p $USER
sleep 3
print -p $PASSWD
sleep 3

print -p "show sntp"
print -p logout

wait
exit 0

Assume that script name is gokcell, and you have some remote Device, It can be Cisco Aggregator or Router,Juniper, Alcatel Dslam,FTTX,or Huawei or any kinf of Transmission device. Then it will automatically login.
Usage: ./gokcell 10.10.10.10

Regards,
Goksel Yangin
Computer Engineer

Last edited by Scott; 07-07-2013 at 09:47 AM.. Reason: Code tags, please...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

FFT for the AMIGA through ksh88 shell.

I don't know if anyone is interested but I have been meddling with FFT for the AMIGA. (Sadly we AMIGAns don't have these luxuries through any scripting language. Below is a Python snippet that uses the builtin 'cmath' module to work with the lowly Python 2.0.1 for the AMIGA. It is part of a... (0 Replies)
Discussion started by: wisecracker
0 Replies

2. Solaris

Solaris scripting problem with ksh88

Hello, I want to pick a random element from a list, and created these 2 lines, which work very well in ksh93. Unfortunately, I get this "bad substitution" message in ksh88. I'm wondering if there's an equivalent to the second line of my script.. or if I have to install ksh93 to make this... (8 Replies)
Discussion started by: gfroute
8 Replies

3. Shell Programming and Scripting

Zip size is different though files are same in ksh88

I'm using Ksh88 . I've last day files in one directory and current month files in another directory , having the same naming convention. Now i need to compare these folders size , if there is no change in these files then no action to be performed else if there is a change then i need to call... (1 Reply)
Discussion started by: smile689
1 Replies

4. Shell Programming and Scripting

Comparing Strings in ksh88

Hi I tried the following string comparison script in Ksh88 #!/bin/ksh str1='aC' str2='ABC' if then echo "Equal" else echo "Not Equal" fi Though str1 and str2 are not equal the script output says Equal . Please correct me Thanks (2 Replies)
Discussion started by: smile689
2 Replies

5. Shell Programming and Scripting

[ksh88 and awk] Number of fields with a value.

Hi, With: # VALUES="one~two~~~" # echo $VALUES | awk 'BEGIN {FS="~"} {print NF}' 5 I can determine the number of fields. How to determine the number of fields with a value ? In this case 2. Thanks in advance, ejdv (6 Replies)
Discussion started by: ejdv
6 Replies

6. Shell Programming and Scripting

namerefs alternative for KSH88

I have to use KSH88, so going to BASH, perl etc. is not an option. Below is a much simplified verison of what I am doing (aka ignore my cut command and i not increasing) :) i=1 BIGSTRING="one two three four five six seven eight" while ]; do typeset "STRING$i=`echo $BIGSTRING| cut -d' '... (8 Replies)
Discussion started by: nitrobass24
8 Replies

7. Shell Programming and Scripting

Download AT&T ksh88 ?

Hello, I need ksh88 for my linux system - and I don't want pdksh. Possible to get original ksh 88 binaries or source ? (I don't need ksh93 which is available) thanks Vilius (1 Reply)
Discussion started by: vilius
1 Replies

8. Shell Programming and Scripting

Substring in ksh88 ?

Hello, ksh88 doesn't support ${var:x:y}. Any alternatives to get substring ? thanks Vilius (2 Replies)
Discussion started by: vilius
2 Replies

9. Shell Programming and Scripting

ksh88 or ksh93

Hi all! Does anybody know how can I check if any UNIX installation has implemented ksh88 or ksh93? Thanks in advance. Néstor. (3 Replies)
Discussion started by: Nestor
3 Replies

10. Shell Programming and Scripting

ksh88 - curses

I was wondering if there is anyway to use the curses library with ksh88. I saw Shell Curses function library which says I can use /usr/local/functions/shellcurses on ksh93 but I am on ksh88. I am on a HP-UX box. (0 Replies)
Discussion started by: IMTheNachoMan
0 Replies
Login or Register to Ask a Question