The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
running script after closing telnet shinjeck SUN Solaris 2 10-29-2007 07:52 AM
problems running a sql loader script jibbadiah UNIX for Dummies Questions & Answers 2 01-03-2007 05:23 AM
telnet, ftp is running but can't connect from outside Micz UNIX for Dummies Questions & Answers 0 01-14-2006 11:15 PM
Problems with telnet. cordobapablo UNIX for Dummies Questions & Answers 2 10-17-2005 10:22 AM
Problems with Telnet Lestat UNIX for Dummies Questions & Answers 1 07-22-2005 06:28 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-03-2006
pauljohn pauljohn is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 6
Running Script from Telnet - Problems

...so I read "The Pragmatic Programmer" and they stressed the value of learning shell scripting!

I'm in a UNIX environment but have a Windows XP workstation.

I'm using Telnet to issue UNIX commands. I've done plenty of chmod's, command line ftp and stuff, but written no scripts to this point.

I've written a simple script with commands which work on the command line, but not from the script.

In essence it's this:

1. #!/bin/sh
2. echo "starting..."
3. ftp -inv <<EOF
4. open <host>
5. user me mypwd
6. cd /dir/xml/
7. mput /dir/xml/*.*
8. quit
9. EOF

When I run it line 6 produces a 250 CWD command successful
line 7 produces "?Invalid command"

At least I think its line 7 - it doesn't actually say.

Appreciate any pointers to get me going on this.

Thanks,

Paul
  #2 (permalink)  
Old 10-03-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,643
When you're inside a program, like ftp, scripts are not what you need. You can try
one of these ways to make it work:
one way:
Code:
echo "
verbose
open <remote_node>
user <username password>
lcd </path>
cd </remotepath>
pwd
get somefile
bye 
" | ftp
or with a here document
Code:
ftp remote_node <<EOF
user <username password>
lcd </path>
cd </remotepath>
pwd
get somefile
bye 
EOF
<<EOF marks the start, EOF marks the end of the here document.

If you are using ksh consider coprocesses - search the FAQ here for ftp.
Sponsored Links
Closed Thread

Bookmarks

Tags
unix commands

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0