Hi How to redirect the output of exec


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Hi How to redirect the output of exec
# 1  
Old 03-12-2008
Hi How to redirect the output of exec

Hi

Here i have a script a

#!/usr/bin/env tclsh

puts "Hello World!"
set filename "./BesRun.sh"

[exec $filename ] > out.txt

exit


I am trying to redirect the output of the "./BesRun.sh" to out.txt,but it is not happening can anyone let me know
# 2  
Old 03-12-2008
I've been not able to run
[exec ...
- the [exec is assumed a command.
Do you mean to have a space?
Also I do not see a reason for '[ ]'
Without that output is written.
Are you awared that after 'exec' you do not executing any line from current script as it replaces the current script with executed one: $filename?

But I am not shure about your start line - why and what you have done by that. Maybe it makes a difference
# 3  
Old 03-23-2008
I'm not overtly familiar with TCL, and you should probably mention which language you are dealing with (witness Alex' confusion above).

AlternativeToExec suggests that this is not really possible, but also provides a number of (ugly) workarounds.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Exec command - different output

Hi Guys, I am trying to to execute the below script in two different machines#!/bin/ksh ############################################################################### # File : pause ############################################################################### print "\nPlease Press \033Its... (4 Replies)
Discussion started by: s_premkumar
4 Replies

2. Shell Programming and Scripting

Several exec on find send all the output to the last redirection

Example script: find mydir -type f -exec echo {}>aaa \; -exec echo {}>bbb \;The two paths go the the bbb file, while there should be one of them on each file. How should I do it to get it working? (2 Replies)
Discussion started by: Tribe
2 Replies

3. Shell Programming and Scripting

Redirect script output to a file and mail the output

Hi Guys, I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts. I used below but it is not working: OFILE=/home/home1/report1 echo "report1 details" > $OFILE =/home/home1/1.sh > $OFILE echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies

4. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

5. UNIX for Dummies Questions & Answers

File redirect with find -exec

I'm trying to do an in-place encoding conversion in bash on a new Cygwin install, and this is the one-liner I've tried: $ find . -name '*.txt' -exec iconv -f UTF-8 -t CP932 {} > {} \;While the brace expansion works for multiple parameters (for example, -exec mv {} {}.bk), the redirect seems to... (1 Reply)
Discussion started by: R_Frankum
1 Replies

6. Shell Programming and Scripting

stdout redirect is working buy direct script exec but not in cron

Hi @ all :) i made a very little shell script witch is working well when i'm launching it directly like with ./script but when i'm launching it by cron tab it work at half only. the part of the script witch are not working are: #!/bin/sh apt-get updade apt-get -s upgrade >>... (5 Replies)
Discussion started by: calibal
5 Replies

7. Shell Programming and Scripting

Output redirection to exec does not work

Hello Experts, I am on Solaris 10 Due to some limitations in one of the vendor software, I am forced to output the command to exec and then run it from there. For example.. $(echo "/usr/bin/cp a.dat b.dat") # This works However, $(echo "/usr/bin/cat a.dat > c.dat") # This does not... (8 Replies)
Discussion started by: Gokul Kumar G
8 Replies

8. Shell Programming and Scripting

Capturing the output from an exec command

Hi, I'm new to ksh - unix platform. I'm writing a small script which will search my current directory and will search for file names which it takes input from the users. Here is the code I'm having. 1 #!/bin/ksh 2 echo "enter a file name to be searched in the current dir : " 3 read... (1 Reply)
Discussion started by: avik
1 Replies

9. Shell Programming and Scripting

Redirect Output

Hi, I would like to list files: ls *.hdf But I would like a copy of the output directed to the screen, but also APPENDED to a text file: test.txt I have tried: ls *.hdf | tee test.txt However, that will just write over everything already existing in test.txt. How can I append the... (1 Reply)
Discussion started by: msb65
1 Replies

10. Shell Programming and Scripting

Redirect output

Hi all, I have a script which call a java program, the logging (to log file) in the program is done using log4j. However, as a safety measure, i still choose to direct standard error to another log file as follow /usr/bin/java -classpath ${classpath} -Xmx128m TestingProgram 2>>... (1 Reply)
Discussion started by: mpang_
1 Replies
Login or Register to Ask a Question