LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-23-2009, 07:49 AM   #1
satya_seth
LQ Newbie
 
Registered: May 2009
Posts: 11

Rep: Reputation: 0
Problem in redirecting the output of program in xterm


Hi

I am opening a xterm in "execute command mode" through another terminal to run a program and i want to redirect the output of that program to a file. It is able to redirect fully to that file as after running the program for some time, it is giving "read: Input/Output Error"

I have made the following observations
1. Opened a terminal.
2. Given command xterm -hold -e "command > temp.txt 2>&1"
3. Closed the xterm after some time using killall xterm
4. But after some time i am not able to get the complete output of that program in the file and getting "read: Input/output error" at the end of the file

Can anyone help me out please

Regards
Satyabrata
 
Old 05-23-2009, 08:19 AM   #2
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
This is an error message from 'command'-make sure you're giving it the correct args. Then again, from your redirect of stderr to stdout, I guess this is what you're testing? (More information needed here, what you've output isn't very helpful)

Does your 'command' output errors on stderr?
 
Old 05-23-2009, 08:33 AM   #3
satya_seth
LQ Newbie
 
Registered: May 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for your quick reply

If i am not redirecting the output to the file and if i am simply giving

xterm -hold -e "command/program",

it is executing completely and i can see the complete output on the xterm terminal.
I have used 2>&1 intentionally to see the error during writing to file.
If i am not giving 2>&1, it is not redirecting the complete output to the file and not showing "read: Input/Output Error" msg in the file as well.

Regards
Satyabrata
 
Old 05-23-2009, 08:37 AM   #4
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
Okay, well what command are you outputting? Lets see if we can troubleshoot it that way.

Incidentally, you're having to killall because of the 'hold' switch, to solve another of your problems from the first.
 
Old 05-23-2009, 08:47 AM   #5
satya_seth
LQ Newbie
 
Registered: May 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Actually, i am trying to execute an executable file and it returns around 1200 lines after successfully executing.

Using xterm, the program is sucessfully executing, but the content is not redirecting completely to the output file.

Is there any limitation in xterm for buffer??

In my earlier post, i had mentioned that i am killig the xterm using killall xterm.

Regards
Satyabrata
 
Old 05-23-2009, 08:54 AM   #6
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
Sure, but what command is it? What is the invocation for the command? And its not the xterm buffer here thats the problem, its the shell you're using
 
Old 05-23-2009, 08:57 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
I don't understand why you're jumping through the hoop of calling an xterm from an xterm. Why not just:

nohup cmd >cmd.log 2>&1 &

in the first level xterm ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in redirecting the output of command in gnome-terminal satya_seth Linux - Newbie 1 05-23-2009 07:05 AM
A little help with redirecting output tybalt Linux - Newbie 1 08-04-2007 11:08 PM
redirecting output using > cmk77 Slackware 8 11-10-2006 03:08 AM
Redirecting sh output to a pipe elmafiacs Programming 0 05-10-2006 02:55 PM
how to redirecting the standard output in program phil123 Linux - General 3 02-23-2004 01:02 AM


All times are GMT -5. The time now is 02:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration