-   Programming (
-   -   Help writing a shell script! (

smoothdogg00 04-25-2006 10: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 10:56 PM

Sure sounds like homework.

smoothdogg00 04-25-2006 10: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-25-2006 11:03 PM

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.



sailu_mvn 04-25-2006 11:30 PM

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 11:15 AM

open two xterms

and do
cat >> file

and what you type will go in the file.

find . >> file


All times are GMT -5. The time now is 05:45 PM.