Sponsored Content
Top Forums Shell Programming and Scripting here-doc convert 2 script convert to single script? Post 77384 by yongho on Thursday 7th of July 2005 03:59:09 PM
Old 07-07-2005
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..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert a paragraph to single line

I need to check the count of pipes on each line of the data to make sure we 4 pipes if its less i need to keep adding the string to form a single line ( Need to join/ concat the below lines until i get the 4 pipes which is end of record ). This fields is basicall a memo where the user would have... (6 Replies)
Discussion started by: rimss
6 Replies

2. Shell Programming and Scripting

how to convert unix .ksh script to windows .batch script

I am using awk in my .ksh script but when I am trying to run in windows its not recognising awk part of the ksh script , even when I changed it to gawk it does not work, this is how my .ksh and .bat files look like. thanx. #!/bin/ksh egrep -v "Rpt 038|PM$|Parameters:|Begin |Date: |End... (1 Reply)
Discussion started by: 2.5lt V8
1 Replies

3. Shell Programming and Scripting

convert PERL script to SHELL script

Hi all experts, I am new to Unix. Could you please help me to convert the following PERL script to SHELL? I will appreciate. #!/bin/sh use strict; use warnings; my $robot_num = 0; my %rob_tapes; foreach (`/usr/openv/volmgr/bin/vmquery -l -rn $robot_num`) { $rob_tapes{(split)} = 1; }... (6 Replies)
Discussion started by: ma466
6 Replies

4. Shell Programming and Scripting

how to convert XLS to CSV and DOC/RTF to TXT

Hi, i don't know anything about PERL. Can anyone help me providing PERL scripts for 1. converting XLS to CSV (and vice-versa) 2. converting DOC/RTF to TXT Thanks much Prvn (1 Reply)
Discussion started by: prvnrk
1 Replies

5. Shell Programming and Scripting

Shell Script to convert multilines to single lines

Hi, I need to create an script which reads multi lines and convert it to single line or enter escape sequence at end "\". e.g. #!/bin/sh echo -e "provide me query to run" read query create table test( id int(11), name char); echo $query But it's failing because of multi line... (8 Replies)
Discussion started by: mirfan
8 Replies

6. Shell Programming and Scripting

Convert columns to single row

Hello all I have data like 1 2 3 4 5 I wish my output would be like 1,2,3,4,5 For this i have executed 'BEGIN {FS="\n"; ORS=","} {print $0}' test and got the output as 1,2,3,4,5, I do not want to have , at the end of 5. output should be like (5 Replies)
Discussion started by: vasuarjula
5 Replies

7. Shell Programming and Scripting

how to convert a shell script to a php script for displaying next word after pattern match

I have a shell script which I made with the help of this forum #!/bin/sh RuleNum=$1 cat bw_rules | sed 's/^.*-x //' | awk -v var=$RuleNum '$1==var {for(i=1;i<=NF;i++) {if($i=="-bwout") print $(i+3),$(i+1)}}' Basically I have a pages after pages of bandwidth rules and the script gives... (0 Replies)
Discussion started by: sb245
0 Replies

8. Shell Programming and Scripting

Help: how to convert perl script to shell script

bash$ mdb-schema x.mdb | perl -wpe 's%^DROP TABLE %DROP TABLE IF EXISTS %i; s%(Memo/Hyperlink|DateTime( \(Short\))?)%TEXT%i; s%(Boolean|Byte|Byte|Numeric|Replication ID|(\w+ )?Integer)%INTEGER%i; s%(BINARY|OLE|Unknown (+)?)%BLOB%i; s%\s*\(\d+\)\s*(,?*)$%${1}%;' | sqlite3 x.db ... (1 Reply)
Discussion started by: jackpapa
1 Replies

9. Shell Programming and Scripting

Kindly help me out to convert this script to shell script.

set +v echo "Program Name :" $0 # echo "Next param :" $1 echo "Next param :" "Username/Password" echo "User Id :" $2 echo "User Name :" $3 echo "Request ID :" $4 echo "Original File Name ... (4 Replies)
Discussion started by: Ganesh1985
4 Replies

10. Shell Programming and Scripting

Shell script to convert IP range csv into a list of single IP's

Hi All, I am looking for some help to convert a csv with IP ranges in.. in the format e.g. 1.1.1.2, 1.1.1.5 2.1.1.10, 2.1.1.20 and would be looking to output as follows: 1.1.1.2 1.1.1.3 1.1.1.4 1.1.1.5 2.1.1.10 2.1.1.11 etc etc up to 2.1.1.20 I have tried a few google... (4 Replies)
Discussion started by: zippyzip
4 Replies
Tcl_AllowExceptions(3)					      Tcl Library Procedures					    Tcl_AllowExceptions(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_AllowExceptions - allow all exceptions in next script evaluation SYNOPSIS
#include <tcl.h> Tcl_AllowExceptions(interp) ARGUMENTS
Tcl_Interp *interp (in) Interpreter in which script will be evaluated. _________________________________________________________________ DESCRIPTION
If a script is evaluated at top-level (i.e. no other scripts are pending evaluation when the script is invoked), and if the script termi- nates with a completion code other than TCL_OK, TCL_ERROR or TCL_RETURN, then Tcl normally converts this into a TCL_ERROR return with an appropriate message. The particular script evaluation procedures of Tcl that act in the manner are Tcl_EvalObjEx, Tcl_EvalObjv, Tcl_Eval, Tcl_EvalEx, Tcl_GlobalEval, Tcl_GlobalEvalObj, Tcl_VarEval and Tcl_VarEvalVA. However, if Tcl_AllowExceptions is invoked immediately before calling one of those a procedures, then arbitrary completion codes are per- mitted from the script, and they are returned without modification. This is useful in cases where the caller can deal with exceptions such as TCL_BREAK or TCL_CONTINUE in a meaningful way. KEYWORDS
continue, break, exception, interpreter Tcl 7.4 Tcl_AllowExceptions(3)
All times are GMT -4. The time now is 09:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy