From owner-freebsd-questions@FreeBSD.ORG Wed Feb 20 12:40:14 2013 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5BC0FCBA for ; Wed, 20 Feb 2013 12:40:14 +0000 (UTC) (envelope-from fbsd8@a1poweruser.com) Received: from mail-03.name-services.com (mail-03.name-services.com [69.64.155.195]) by mx1.freebsd.org (Postfix) with ESMTP id 4936FEF3 for ; Wed, 20 Feb 2013 12:40:14 +0000 (UTC) Received: from [10.0.10.3] ([173.88.202.176]) by mail-03.name-services.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 20 Feb 2013 04:40:10 -0800 Message-ID: <5124C428.1080909@a1poweruser.com> Date: Wed, 20 Feb 2013 07:40:08 -0500 From: Fbsd8 User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: FreeBSD questions Subject: sh script & files Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 20 Feb 2013 12:40:10.0603 (UTC) FILETIME=[6BDD33B0:01CE0F67] X-Sender: fbsd8@a1poweruser.com X-Authenticated-Sender: fbsd8@a1poweruser.com X-EchoSenderHash: [fbsd8]-[a1poweruser*com] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 12:40:14 -0000 I noticed that when power fails I loose the contents of some files I am using in a sh script. I read and write the file this way file="/usr/local/etc/filename" # read file . "${file}" # 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? Thanks