Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Nov 2010 15:12:24 +0000 (UTC)
From:      naddy@mips.inka.de (Christian Weisgerber)
To:        freebsd-hackers@freebsd.org
Subject:   Re: Spinner Function for Shell Scripts
Message-ID:  <ic644o$15nb$1@lorvorc.mips.inka.de>
References:  <1289506363.30235.113.camel@localhost.localdomain> <AANLkTi=Us-OoLHpO2YPM4VCgFUQM2BX3jcPSaJnXF9rG@mail.gmail.com> <2CCA101F-22FA-4CE2-8F4C-117824CEA104@vicor.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Devin Teske <dteske@vicor.com> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ic644o$15nb$1>