Unix shell output redirection help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unix shell output redirection help
# 1  
Old 08-26-2009
Error Unix shell output redirection help

Hi all,

Actually i need to know whether there is any way to redirect the output of shell operations into any file without pipe .

Actually my problem is , i run some command & its result is displayed on shell after some calculations on shell, so if i redirect its output to file, it is not getting written over there.

eg echo <SOME COMMAND> | tee -a file.txt

So after this there is nothing in this file. instead the result is shown on shell terminal after 3 or 4 seconds. So i just need to know if i can set any variable so that it can re direct that output to file. or there is any other way of doing it.

Thanks in advance


Thanks
Sarbjit
# 2  
Old 08-26-2009
Is this a homework assignment? This is similar question:

https://www.unix.com/shell-programmin...g-console.html
# 3  
Old 08-26-2009
I need the solution urgently.

You are not getting my point, if i use redirection it doesn't displays the result in file. It move to next command. So what i need is to redirect stdout output to file so that i can have that result.
# 4  
Old 08-26-2009
Quote:
Originally Posted by sarbjit
I need the solution urgently.

You are not getting my point, if i use redirection it doesn't displays the result in file. It move to next command. So what i need is to redirect stdout output to file so that i can have that result.
Maybe you're not getting my point: Is this a homework question?
# 5  
Old 08-26-2009
Hi franklin

yeah you can say that. I am working on some project and i need this info to be dumped in a file.

Now getting to point, Is it possible to redirect stdout output to file. i have tried using pipe symbol and redirection operators but, it doesn't writes that to file, i have even tried using sleep command, but of no success.

Can you please let me know how to proceed

Thanks

---------- Post updated at 07:17 PM ---------- Previous update was at 07:16 PM ----------

Hi franklin

yeah you can say that. I am working on some project and i need this info to be dumped in a file.

Now getting to point, Is it possible to redirect stdout output to file. i have tried using pipe symbol and redirection operators but, it doesn't writes that to file, i have even tried using sleep command, but of no success.

Can you please let me know how to proceed

Thanks
# 6  
Old 08-26-2009
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

output redirection

Hi all I was wondering if there was a slicker way of doing this without the file - awk '{print $2}' FS=":" "${FILE}" > "${TMPFILE}" { read M_GRP_ID || m_fail 1 "Error: Read failed 1 (${FUNCNAME})" read M_GRP_WAIT || m_fail 1 "Error: Read failed 2 (${FUNCNAME})" }... (6 Replies)
Discussion started by: steadyonabix
6 Replies

2. Shell Programming and Scripting

Output redirection of c binary file to a file in shell script is failing

I am struck up with a problem and that is with output redirection. I used all the ways for the redirection of the output of c binary to a file, still it is failing. Here are the different ways which I have used: ./a.out | tee -a /root/tmp.txt 2>&1 ./a.out | tee -a /root/tmp.txt 1>&1 ./a.out |... (2 Replies)
Discussion started by: Maya29988
2 Replies

3. Shell Programming and Scripting

Redirection of ls -l output

Hi I am making a script where i want to redirect the output of ls -l to a file Example #ls -l fil1.txt > /opt/temp/a.txt ac: No such file or directory I want to capture output of this command like here output is ac: No such file or directory can anyone help (4 Replies)
Discussion started by: anish19
4 Replies

4. Shell Programming and Scripting

Shell script output redirection question

OS : AIX 6.1 Shell : Korn in the url https://forums.oracle.com/forums/thread.jspa?threadID=361463&tstart=0 I came across a crontab entry example 00 23 * * 1,3,5 <complete shell script path> 1> <log file> 2>&1 From googling , I gathered that 0 - stdin 1 - stdout 2 - stderr I... (5 Replies)
Discussion started by: polavan
5 Replies

5. UNIX for Dummies Questions & Answers

Output redirection

Hello i am trying to write a script that will redirect the output to a certain file. Here is the code so far: #!/bin/bash ps -e | sort | more > psfile When I execute the script nothing happens since i assume the output was redirected to the file called psfile. When I try to look at the... (1 Reply)
Discussion started by: mfruiz34
1 Replies

6. Shell Programming and Scripting

Output redirection

We have an application here that does some table queries and then prints the result on screen. I do not have the code of this application (which i will just call "queryCommand"), but what it does is that you call it with some parameters and it prints some info about the query and then the... (5 Replies)
Discussion started by: jolateh
5 Replies

7. Shell Programming and Scripting

Redirection output

Hi there I have a script that runs but it outputs everything onto the screen instead of a file. I've tried using the > outputfile.txt however all it does is dump the output to the screen and creates an outputfile.txt but doesn't put anything in that file. Any help would be appreciated ... (6 Replies)
Discussion started by: kma07
6 Replies

8. Shell Programming and Scripting

Help with Output Redirection of a Unix Shell Script

Hi Guys, I have a script for which the stdout and stderr should be redirected to a log file, they should not be printed on the screen. Could you please let me know the procedure to redirect the output of the script to a log file. Thanks in advance. --- Aditya (5 Replies)
Discussion started by: chaditya
5 Replies

9. Shell Programming and Scripting

redirection and output

I'm redirecting the output of a command to a logfile, however, if the user is on a terminal I would also like the output to be displayed on the screen. tar tvf some_tarfile >Logfile if the user is on a term then have the output to the Logfile and also be displayed on the screen at the same... (2 Replies)
Discussion started by: nck
2 Replies

10. Shell Programming and Scripting

Asking about shell script input output redirection

Hi, Can anyone please tell me what these lines do? ls >& outfile ls outfile 2>&1 Thanks. (1 Reply)
Discussion started by: trivektor
1 Replies
Login or Register to Ask a Question