?
Solved

Redirect program related command output to file

Posted on 2004-10-18
4
Medium Priority
?
531 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
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.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

771 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