Spinner Function for Shell Scripts
Christian Weisgerber
naddy at mips.inka.de
Fri Nov 19 15:45:39 UTC 2010
Devin Teske <dteske at 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 at mips.inka.de
More information about the freebsd-hackers
mailing list