Solved

How to write contents of a pipe?

Posted on 1998-08-25
5
268 Views
Last Modified: 2011-09-20
Hwo can I write a script in a file created by mknod file p. inside of this pipe I want to put a script and I will chamge its permission. I tried to write in a pipe file but it seems impossible. Sugesstions?!
0
Comment
Question by:mega_tron
5 Comments
 
LVL 2

Expert Comment

by:kellyjj
ID: 2006787
do it in C.
0
 

Expert Comment

by:izar
ID: 2006788
A pipe isn't really a file, it is a way of doing IPC (interprocess communication). For a pipe to be effective, you need a writer and a listener, that can be or not the same process. More to the tone of your question, you can't "write a script in a file created by mknod file p" because it is not a file - it has no inode storage.
You probably need to rethink your approach to the problem.
0
 

Author Comment

by:mega_tron
ID: 2006789
izar,
 you are right, I was not aproaching real well to the idea that was hammering in my mind. I want to write a pipe(or script) that can be executed while somebody is fingering me(using finger*). At finger(I am just a normal user -- If I was root I can do better than ever) I have the control of two files .plan and .project. I there any way that by using these files I can make a script running. If yes any suggestion??
0
 

Accepted Solution

by:
tphipps earned 50 total points
ID: 2006790
This is much easier to do in a very basic C program than a shell script.  Checkout this example:

http://www.twisted-helices.com/computing/plan/plan.html

Remember that your dynamic .plan program will need to be always running on your machine (and waiting to receive requests), instead of being started each time you are fingered - there's no easy way to start a new program each time a finger request comes through.  However this will give you an easy way to do things when you're fingered.

0
 
LVL 5

Expert Comment

by:ecw
ID: 2006791
Easy enough to do as a script eg.
 #!/usr/bin/sh
 trap 'rm -f "$HOME/.plan" ; exit 0' 0 2 3 15
 rm -f "$HOME/.plan" ; mknod -p "$HOME/.plan"
 while : ; do
  echo "Auto plan @ `date`" > "$HOME/.plan"
 done
Start it in the background, and go home.  It will cause problems if the machine is rebooted.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now