![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Capturing output from grpck command on AIX | pdtak | UNIX for Dummies Questions & Answers | 2 | 03-05-2008 02:58 PM |
| capturing line from script output and appending to a file | wally_welder | Shell Programming and Scripting | 6 | 08-31-2007 04:03 AM |
| reading command output from shell script | sri b | Shell Programming and Scripting | 4 | 11-16-2006 12:52 AM |
| Need help capturing pipe to a file in shell script | heinz | Shell Programming and Scripting | 6 | 11-03-2005 08:27 AM |
| capturing output in script | MizzGail | Shell Programming and Scripting | 6 | 06-02-2004 08:44 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I am trying to check to see if a file exists on a ftp server, well, I know that cant be done, atleast directly, So I came up with this small script
Quote:
Code:
ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD cd public_html/crap dir $FILE quit END_SCRIPT Quote:
Code:
{
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd public_html/crap
dir $FILE
quit
END_SCRIPT
} > $CHECK_FILE
if $CHECK_FILE = 0 {
# file does not exist, lets upload the file to the server
}
else {
# file exists on the server, rename the file on server before uploading
}
|
|
||||
|
I am using bourne shell.
I did go on the FAQ site but I dont see an example in which we are trying to capture output generated by a script commands into a variable. Notice the bold S! . What I mean is, I need to capture output fromt the ftp command dir $FILE as this will tell me if the file exists on the ftp server. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|