The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perform action file name written to the pipe fed.linuxgossip Shell Programming and Scripting 2 07-23-2008 11:38 AM
How to Redirect the error messages from Syslog file to our own Application Log File balasubramaniam HP-UX 3 04-17-2008 02:44 PM
How to prevent an application from closing a file jasahl AIX 4 01-06-2008 09:39 PM
Checking a file is not being written to kanejm Shell Programming and Scripting 14 01-20-2006 08:29 AM
File being used/written sanjay92 UNIX for Dummies Questions & Answers 4 10-13-2001 02:31 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-01-2005
GMMike GMMike is offline
Registered User
  
 

Join Date: Sep 2004
Posts: 32
Operating on a file being written by another application

Hi,
I have a directory that is used to store files generated by another application. Each file is huge and can take some time to produce.
I am writing a shell script to check the names and dates of the files and do some functions on the ones that are not being written out.

My question is, if I use a command like cat for example on a file that is being written by another application (while it is being written) will I get an error or will the cat just retunr a zero return code?

For example, if the application was generating file called f1, and I do this:
cat f1>f2
what would be the return code?

I am using Sun/Solaris and I find this kind of hard to test.

Thanks in advance.
  #2 (permalink)  
Old 02-01-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,127
Quote:
Originally Posted by GMMike
I am using Sun/Solaris and I find this kind of hard to test.
Ahem....
Code:
#! /usr/bin/ksh
exec > f1
echo first line
while : ; do
       sleep 1
       echo yet another line
done

Launch that script in the background and then try the cat. The cat will work, but you should understand how to test it anyway.
  #3 (permalink)  
Old 02-01-2005
thumsup9 thumsup9 is offline
Registered User
  
 

Join Date: Jan 2005
Posts: 97
Im not sure but i guess it will say 'Cannot open f1'...

Cheers
Thumsup
  #4 (permalink)  
Old 02-01-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,787
Maybe he is trying to idnetify open files - like fuser or lsof.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0