From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 19 19:28:11 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98EE0106566B for ; Fri, 19 Nov 2010 19:28:11 +0000 (UTC) (envelope-from dteske@vicor.com) Received: from postoffice.vicor.com (postoffice.vicor.com [69.26.56.53]) by mx1.freebsd.org (Postfix) with ESMTP id 7F31B8FC13 for ; Fri, 19 Nov 2010 19:28:11 +0000 (UTC) Received: from [192.168.134.187] (port=62223 helo=[192.168.1.111]) by postoffice.vicor.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) (envelope-from ) id 1PJWcy-0007nY-KD; Fri, 19 Nov 2010 11:28:10 -0800 Mime-Version: 1.0 (Apple Message framework v1081) From: Devin Teske In-Reply-To: Date: Fri, 19 Nov 2010 11:28:07 -0800 Message-Id: <2E23D040-6461-4938-88CE-328A091D7739@vicor.com> References: <1289506363.30235.113.camel@localhost.localdomain> <2CCA101F-22FA-4CE2-8F4C-117824CEA104@vicor.com> To: naddy@mips.inka.de (Christian Weisgerber) X-Mailer: Apple Mail (2.1081) X-Scan-Signature: c61feb86be2d5867fe8e5dc7b9036f8f X-Scan-Host: postoffice.vicor.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: Spinner Function for Shell Scripts X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2010 19:28:11 -0000 On Nov 19, 2010, at 7:12 AM, Christian Weisgerber wrote: > Devin Teske wrote: >=20 >>>> So, just as the subject-line says, ... here's an efficient and = robust >>>> spinner function compatible with many shells. >>>> DONE=3D$( /bin/sh -c 'read -t 0 DONE; echo = $DONE' ) >>>=20 >>> Is this expected to be portable to other operating systems? The dash >>> shell, used as /bin/bash in Ubuntu, does not acept the "-t" argument >>> to the read builtin command. Using /bin/bash solves the problem. >>=20 >> I was shooting for bourne-shell, >=20 > FreeBSD's /bin/sh is *not* a Bourne shell. I see that now from the sh(1) manual (had been assuming it was true to = its roots from 4.4BSDLite -- ala FreeBSD-1.0). More akin to Korn shell = while maintaining POSIX.2 spec. >=20 >> It's rather unfortunate that bourne-shell has what we need but is not >> available on all operating systems since many OSes have started = swapping >> out bourne-shell for it's younger cousin. >=20 > A traditional Bourne shell, such as Solaris's, does not implement > read -t at all. Thanks! I guess that means that this code is specific to FreeBSD. I guess that = means I love FreeBSD even more than I did before. Unfortunately, that = means that if I want to implement this spinner on any other platform, = I'll have to resort to my previous impementations -- using backgrounding = and/or temporary files on-disk. >=20 > --=20 > Christian "naddy" Weisgerber = naddy@mips.inka.de >=20 > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to = "freebsd-hackers-unsubscribe@freebsd.org" -- Cheers, Devin Teske -> CONTACT INFORMATION <- Business Solutions Consultant II FIS - fisglobal.com 510-735-5650 Mobile 510-621-2038 Office 510-621-2020 Office Fax 909-477-4578 Home/Fax devin.teske@fisglobal.com -> LEGAL DISCLAIMER <- This message contains confidential and proprietary information of the sender, and is intended only for the person(s) to whom it is addressed. Any use, distribution, copying or disclosure by any other person is strictly prohibited. If you have received this message in error, please notify the e-mail sender immediately, and delete the original message without making a copy. -> END TRANSMISSION <-