On Wed, 20 Feb 2013 07:40:08 -0500, Fbsd8 wrote:
> # write to file
>  > "${file}"
> 
> I'm thinking the file is never closed so on power failure I loose the 
> contents of the file.
> 
> How would I code a command to close the file?

The file is closed when the write operation has been
finished. You can use the "sync" command to flush
pending writes to the file (as writing is handled
asynchronously by the system). When the program
that writes to the file exits, it will close the
file it's writing to. This depends on the command
you're using infront of >, as the command you've
shown will simply generate a null file (file with
no actual content).


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to