Solved

Redirect program related command output to file

Posted on 2004-10-18
4
518 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
  • 3
4 Comments
 
LVL 38

Expert Comment

by:yuzh
Comment Utility
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
Comment Utility
To save out of timex and someprogram to seperate files you do:

timex someprogram 1>>prgoutput  2>>timexoutput
0
 

Author Comment

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

Accepted Solution

by:
yuzh earned 500 total points
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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 …
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now