Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Redirect program related command output to file

Posted on 2004-10-18
4
Medium Priority
?
535 Views
Last Modified: 2010-04-21
I want to run a program and be able to redirect memory usage of the program into a file. eg. timex someprogram >> somefile
However, when I do that, the output of the program goes into the file not the output of timex.
Also, I need a command to capture memory usage.

rsshetty
0
Comment
Question by:rsshetty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 12344813
You need to redirect the stdin to file to get the out put of someprogram, eg:

timex someprogram 1>>somefile

or :
to get output of timex:
timex someprogram 2>>somefile
0
 
LVL 38

Expert Comment

by:yuzh
ID: 12344826
To save out of timex and someprogram to seperate files you do:

timex someprogram 1>>prgoutput  2>>timexoutput
0
 

Author Comment

by:rsshetty
ID: 12346801
I did what yuzh wrote but it gives me an error saying Ambiguous output redirect.
0
 
LVL 38

Accepted Solution

by:
yuzh earned 2000 total points
ID: 12347559
My previous comments work for sh/ksh/bash!

you are using csh/tcsh, for csh/tcsh you can do:

(timex someprogram > prgoutput)>&timexoutput

For shell scripting you should use sh/ksh/bash, it is a lot easy to do things than csh/tcsh.

please have a look at "Csh Programming Considered Harmful":
http://www-dbs.inf.ethz.ch/~fessler/csh-whynot.html


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question