?
Solved

How to write contents of a pipe?

Posted on 1998-08-25
5
Medium Priority
?
278 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 100 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

770 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