Solved

Redirect program related command output to file

Posted on 2004-10-18
4
520 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
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 500 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

840 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