The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
Want To convert script in Linux format niceboykunal123 Shell Programming and Scripting 1 05-28-2008 09:27 AM
How to convert a single column into several rows and columns? ashton_smith UNIX for Dummies Questions & Answers 5 05-24-2008 05:44 PM
script to convert absolute date onthetopo UNIX for Dummies Questions & Answers 2 07-06-2007 08:37 PM
how to convert unix .ksh script to windows .batch script 2.5lt V8 Shell Programming and Scripting 1 11-28-2006 12:52 PM
Convert a paragraph to single line rimss Shell Programming and Scripting 6 06-07-2006 04:17 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-07-2005
yongho yongho is offline
Registered User
  
 

Join Date: Jun 2005
Location: New York City
Posts: 95
here-doc convert 2 script convert to single script?

I have my main script calling another script to retrive a "ls -alt" of a directory that's located in a remote location I'm sftping into.

main.sh

Code:
#!/bin/ksh
getLS.sh > output.txt

getLS.sh

Code:
#!/bin/sh
/home<..>/sftp <host@ip> <<!
cd /some/dir/Log
ls -alt
quit
!

Basically I'd like to be able to combine the second script into the first and not have to call a second script.

Would this work?

Code:
#!/bin/sh
/home<..>/sftp <host@ip> <<!
cd /some/dir/Log
ls -alt
quit
!
> output.txt

If it does work, why does it work?
I've always been using the stdout redirect like this:
command > output..

I didn't know you could do
command1
command2
command3
> output..

Last edited by yongho; 07-07-2005 at 05:05 PM..
  #2 (permalink)  
Old 07-07-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,127

Code:
#!/bin/sh
/home<..>/sftp <host@ip> >output.txt <<!
cd /some/dir/Log
ls -alt
quit
!

  #3 (permalink)  
Old 07-07-2005
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
I don't have the sftp handy right now, but Solaris' stock ftp client can store the ouput of the 'ls' on the local machine.
Quote:
Originally Posted by man ftp
ls [ remote-directory | -al ] [ local-file ]
Print an abbreviated listing of the contents of a
directory on the remote machine. If remote-
directory is left unspecified, the current working
directory is used.

If no local file is specified, or if local-file is
-, the output is sent to the terminal.
Also:

Code:
/home<..>/sftp <host@ip> <<! > output.txt 2>&1
............
............
!

Closed Thread

Bookmarks

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:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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