LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-13-2005, 11:36 PM   #1
angustia
Member
 
Registered: Apr 2003
Location: chile
Posts: 58

Rep: Reputation: 15
cat | xterm -e something


hi, someone knows if that can be done?

...some parameter for xterm (or another X terminal) to make it to redirect his stdin to the process that's running (and stdout)?

thanx.
 
Old 05-14-2005, 11:20 AM   #2
runlevel0
Member
 
Registered: Mar 2005
Location: Hilversum/Holland
Distribution: Debian GNU/Linux 5.0 (“Lenny”)
Posts: 290

Rep: Reputation: 31
I can't stat what you intend to do.

What is this piped cat doing anyway?

Keep one thing in mind: Each terminal is a separate shell, with it's own env variables.

What does it mean "Redirecting the STDIN to a process"?
AFAIK that's exactly what the STDIN does, pass arguments or data to an interactive process and STDOUT is until changed the shell where it runs.

Could you please be more explicit so we can help?
 
Old 05-14-2005, 11:37 AM   #3
angustia
Member
 
Registered: Apr 2003
Location: chile
Posts: 58

Original Poster
Rep: Reputation: 15
i mean:

launch program A and its output goes through a pipe to another program running in another xterm ( to see both programs talking)
 
Old 05-14-2005, 11:49 AM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
The easiest way to do it would be with named pipes.

man 1 mkfifo
man 3 mkfifo


Have one process write to the fifo, have the other read it, and then delete it when done.
 
Old 05-15-2005, 05:32 AM   #5
runlevel0
Member
 
Registered: Mar 2005
Location: Hilversum/Holland
Distribution: Debian GNU/Linux 5.0 (“Lenny”)
Posts: 290

Rep: Reputation: 31
Quote:
Originally posted by angustia
i mean:

launch program A and its output goes through a pipe to another program running in another xterm ( to see both programs talking)
this is more or less what you need

Code:
mkfifo -m 0666 fifo01
Where '0666' is the mode. You can also use symbolic notation such as +rw or even set the user as with a normal file.

Now all you need to do is redirecting the STDOUT of the first program to fifo01:

Code:
ls -R / > fifo01
and read it from the second console (for example with cat):
Code:
cat fifo01

if you would like a more elegant interface (and you are using KDE) I would give Kommander a look, it enables you to create GUIs for shell script in any scripting language (but specially bash), it's quite straightforward and to connect two shells you only have to use the mouse.
 
Old 05-15-2005, 05:38 PM   #6
angustia
Member
 
Registered: Apr 2003
Location: chile
Posts: 58

Original Poster
Rep: Reputation: 15
thanx. i asked cause i must think a homework to show usage of pipes, and i wished to show two programs talking and not need to use graphical libraries.
 
  


Reply



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
xterm - howto lauch an xterm into a specific directory jobano Linux - Software 11 01-30-2023 04:45 AM
how is black xterm background in IceWM when issue a xterm command? BRAHmS Linux - Software 1 02-14-2005 03:51 AM
Cat ... Beuzekom Linux - Newbie 4 01-19-2004 05:32 PM
cat notsoevil Linux From Scratch 3 02-14-2002 10:16 AM
regarding cat gui10 Linux - Security 6 12-07-2001 08:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:32 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
Open Source Consulting | Domain Registration