From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 19 15:45:39 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 357D1106566B for ; Fri, 19 Nov 2010 15:45:39 +0000 (UTC) (envelope-from mailnull@mips.inka.de) Received: from mail-in-14.arcor-online.net (mail-in-14.arcor-online.net [151.189.21.54]) by mx1.freebsd.org (Postfix) with ESMTP id D80618FC1D for ; Fri, 19 Nov 2010 15:45:38 +0000 (UTC) Received: from mail-in-01-z2.arcor-online.net (mail-in-01-z2.arcor-online.net [151.189.8.13]) by mx.arcor.de (Postfix) with ESMTP id 44F2F9C630 for ; Fri, 19 Nov 2010 16:12:25 +0100 (CET) Received: from mail-in-12.arcor-online.net (mail-in-12.arcor-online.net [151.189.21.52]) by mail-in-01-z2.arcor-online.net (Postfix) with ESMTP id 40A3C15B897 for ; Fri, 19 Nov 2010 16:12:25 +0100 (CET) Received: from lorvorc.mips.inka.de (dslb-092-075-207-206.pools.arcor-ip.net [92.75.207.206]) by mail-in-12.arcor-online.net (Postfix) with ESMTPS id 193EA264AA for ; Fri, 19 Nov 2010 16:12:25 +0100 (CET) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-12.arcor-online.net 193EA264AA Received: from lorvorc.mips.inka.de (localhost [127.0.0.1]) by lorvorc.mips.inka.de (8.14.4/8.14.3) with ESMTP id oAJFCOkp039037 for ; Fri, 19 Nov 2010 16:12:24 +0100 (CET) (envelope-from mailnull@lorvorc.mips.inka.de) Received: (from mailnull@localhost) by lorvorc.mips.inka.de (8.14.4/8.14.4/Submit) id oAJFCOSa039036 for freebsd-hackers@freebsd.org; Fri, 19 Nov 2010 16:12:24 +0100 (CET) (envelope-from mailnull) From: naddy@mips.inka.de (Christian Weisgerber) Date: Fri, 19 Nov 2010 15:12:24 +0000 (UTC) Message-ID: References: <1289506363.30235.113.camel@localhost.localdomain> <2CCA101F-22FA-4CE2-8F4C-117824CEA104@vicor.com> Originator: naddy@mips.inka.de (Christian Weisgerber) To: 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 15:45:39 -0000 Devin Teske wrote: > >> So, just as the subject-line says, ... here's an efficient and robust > >> spinner function compatible with many shells. > >> DONE=$( /bin/sh -c 'read -t 0 DONE; echo $DONE' ) > > > > 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. > > I was shooting for bourne-shell, FreeBSD's /bin/sh is *not* a Bourne shell. > 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. A traditional Bourne shell, such as Solaris's, does not implement read -t at all. -- Christian "naddy" Weisgerber naddy@mips.inka.de