LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Help writing a shell script! (http://www.linuxquestions.org/questions/programming-9/help-writing-a-shell-script-438870/)

smoothdogg00 04-25-2006 11:52 PM

Help writing a shell script!
 
I need to write a shell script that determines what happens when the '>>' (append) operation accesses a file at the same time as another program. For example:

If two users logged on at the same time and a logfile was being written with the '>>' operation, does the file get accessed by both at the same time, therefore one is overwritten by the other becuase they were working on the same line, or does it wait?

I just need ideas for how to test this, not the actual answer. Thank you.

rickh 04-25-2006 11:56 PM

Sure sounds like homework.

smoothdogg00 04-25-2006 11:57 PM

Haha...yes indeed, but I am lost as to how to do it. I understand the concept, but am not sure how to launch two processes at the same time.

alunduil 04-26-2006 12:03 AM

You could utilize the at deamon or even cron, but at would probably work better for you. Just add two jobs that write different output to the same file. By the system clock they will be simultaneous.

Regards,

Alunduil

sailu_mvn 04-26-2006 12:30 AM

i dont think that buffer for the both the instances at the same time. are u taking the log froma a single system?

bigearsbilly 04-26-2006 12:15 PM

open two xterms

and do
cat >> file

and what you type will go in the file.

or
find . >> file

whatever


All times are GMT -5. The time now is 05:17 AM.