Imported from ../bash-2.0.tar.gz.
This commit is contained in:
parent
726f63884d
commit
ccc6cda312
502 changed files with 91988 additions and 69123 deletions
25
examples/scripts/scrollbar
Executable file
25
examples/scripts/scrollbar
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# scrollbar - display scrolling text
|
||||
#
|
||||
# usage: scrollbar args
|
||||
#
|
||||
# A cute hack originally from Heiner Steven <hs@bintec.de>
|
||||
#
|
||||
# converted from ksh syntax to bash v2 syntax by Chet Ramey
|
||||
|
||||
WIDTH=${COLUMNS:-80}
|
||||
|
||||
[ $# -lt 1 ] && set -- TESTING
|
||||
|
||||
# Posix.2 compatible printf command or bash loadable builtin
|
||||
# in examples/loadables/printf
|
||||
Text=$(printf "%-${WIDTH}s" "$*")
|
||||
Text=$(echo "$Text" | tr ' ' '_')
|
||||
|
||||
while :
|
||||
do
|
||||
printf "%-.${WIDTH}s\r" "$Text"
|
||||
LastC=$(expr "$Text" : '.*\(.\)$')
|
||||
Text=$(printf "%-.${WIDTH}s" "$LastC$Text")
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue