[nylug-talk] spinning slash

Ron Guerin
Fri Nov 17 15:52:39 EST 2006


Peter C. Norton wrote:
> It's easier if you have bash on your other systems, you know...
> 
> If you want to unroll this and turn it into vanilla sh, you need to
> have the printf program and you can write a loop like this (untested):
> 
> for count in 1 2 3 4 5 6 7 8 9 10; do    
>  printf "\b/"; sleep 1;
>  printf "\b-"; sleep 1;   
>  printf "\b\\"; sleep 1;   
>  printf "\b|"; sleep 1; 
> done
> 
> This is somewhat heavy on some systems (a lot of fork+exec) and it's a
> lot better to have bash, pdksh, or zsh on these systems (your scripts
> can have a standard base to run on. /bin/sh is too different on
> different *nix's).

One of my current pet-peeves is that most of the information one finds
on the web is written to be portable, resulting in most people writing
script in bash that would run on a machine in a museum if it had to, but
 isn't code anyone should want to run.  The peeve isn't about portable
code, but the resulting lack of general knowledge about improvements to
bash that are over 10 years out in the world now.

I second the advice.  Install bash.  To which I'm tacking on "Write to
modern bash".  I'd say the same thing about any other shell also.  If
you're using zsh on most of your boxes, install it on the rest, and
don't write Bourne code for it.

- Ron


More information about the nylug-talk mailing list