LinuxQuestions.org
Visit Jeremy's Blog.
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 10-13-2008, 01:45 AM   #1
lin2winwin
LQ Newbie
 
Registered: Nov 2007
Posts: 26

Rep: Reputation: 15
piping input during run-time


Hi,
I have an interactive application (shell) that takes input during runtime. Now, I need to create a channel such a way that when I write to that channel, the input goes to that application. After executing that line, it should wait for next input (through that channel).

I dont know how to do that in bash using redirections, (and how to google for that).

Basically, I want something like this

### Start the application
$ appln [operator] inputchannel > outputfile &
### Send commands to the appliation that runs in background
$ echo "command1 args" > inputchannel
$ echo "command2 args" > inputchannel
....


Can anyone please help me?

Thanks.
 
Old 10-13-2008, 02:46 AM   #2
lin2winwin
LQ Newbie
 
Registered: Nov 2007
Posts: 26

Original Poster
Rep: Reputation: 15
I figured it out. But, dont know if its the right way


Create a script "run.sh" like

Code:
rm my_pipe
mknod my_pipe p
str="tmp"
while [ $str <> "exit" ];
do
        str=`cat my_pipe`;
        echo $str;
        if [ $str == "exit" ]; then
                break;
        fi;
done
Then, run the application (in this case bash shell) as

./run.sh | bash

This script would exit at the command "exit".

I guess there should be some better way to do it...
 
  


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
Is a script, run at boot time from init.d, run with root authority? tmbrwolf53 Linux - Server 2 03-31-2007 08:15 PM
why input key everytime when run quake4 in linux? u2911 Linux - Games 3 11-27-2005 03:48 PM
an open source program that only gives the user a certain amount of time to input? dr_zayus69 Programming 4 05-22-2005 10:56 PM
Piping keyboard input to two processes (or threads) caffeinebot Programming 3 05-17-2005 04:51 PM
Screen goes blank after being idle 4 a long time & then all input devices freeze! hari_seldon99 Linux - Newbie 2 01-28-2004 07:45 PM


All times are GMT -5. The time now is 08:17 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