LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-11-2005, 06:35 PM   #1
chatterbug89
Member
 
Registered: Jun 2004
Distribution: TopologiLinux 4.0.0, Slackware 10.0, LFS 6.0
Posts: 53

Rep: Reputation: 15
send commands to background processes


I want to create a Bash shell script to be able to talk with epic ( a simple IRC client) by outputing commands to it while it is being run in the background. I have tried everythign I could think of and find out. Either it worked, but EOF killed epic or it diden't work at all.

I'm thinking the best way to do this would be with named pipes...so I tried the following....

First I created a pipe.

mkfifo pipe

Then I connect the pipe to epic and send it in the background

epic < pipe &

Finaly, I try to give epic some input, so I do something like

echo "/server blablabla.bla" > pipe

It works, but epic dies right away because of EOF...is there anyway to prevent the EOF. I have also tried replacing echo with cat and putting the commands in a file....same problem.
 
Old 07-13-2005, 09:16 AM   #2
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
Does it work properly when run like this (the epic part) from command line?

while [ 1 -eq 1 ]; do epic < pipe ; done &

Or does

nohup epic < pipe &

have the desired effect, (Yup I don't use epic to try )

Last edited by Looking_Lost; 07-13-2005 at 09:34 AM.
 
Old 07-13-2005, 03:55 PM   #3
chatterbug89
Member
 
Registered: Jun 2004
Distribution: TopologiLinux 4.0.0, Slackware 10.0, LFS 6.0
Posts: 53

Original Poster
Rep: Reputation: 15
Well, no matter what I tried it woudlen't work with epic...so, I tried using nohup like you said with BitchX and it acutaly worked I was talking with peiople on IRC directly from the command line. However, my true plan behind all this is to create a IRC bot with Bash Shell scripting (more just to see if I can do it and as a fun project to do after learning just a littler mroe shell scripting...).

This is where the problem comes...the output epic or irssi (treied that and still got the stupid EOF terminated the program message) is veyr nice and would be easy to filter....BitchX's output isen't. But oh well...i can work with it. If you know a simple IRC program that would work with pipes correctly though that woudl be awesome. Anyways, thanks so much fo ryour help

EDIT: Well...I tried variouse other clients, include ircII, and none of them wanted to work properly with pipes. However, I am happy to say, that after much work I created a IRC bot with BASH shell scripting...of course it is very beta...but it works ^^

Last edited by chatterbug89; 07-13-2005 at 10:00 PM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Limit the number of background processes per user... trendwhore Linux - Security 6 08-27-2004 01:09 PM
background processes digit Linux - Software 3 07-27-2003 12:27 PM
processes in background zetsui Linux - General 8 06-14-2003 12:52 PM
bash: interaction with background processes ... cdex Programming 5 08-11-2002 02:42 PM
background processes hakum Programming 1 04-08-2002 10:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:09 PM.

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