Imported from ../bash-2.02.tar.gz.
This commit is contained in:
parent
e8ce775db8
commit
cce855bc5b
323 changed files with 33916 additions and 12321 deletions
24
examples/scripts/scrollbar2
Executable file
24
examples/scripts/scrollbar2
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/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}
|
||||
WMINUS=$(( $WIDTH - 1 ))
|
||||
|
||||
[ $# -lt 1 ] && set -- TESTING
|
||||
|
||||
# use the bash-2.02 printf builtin
|
||||
Text=$(printf "%-${WIDTH}s" "$*")
|
||||
|
||||
while :
|
||||
do
|
||||
printf "%-.${WIDTH}s\r" "$Text"
|
||||
LastC=${Text:${WMINUS}:1}
|
||||
Text="$LastC""${Text%?}"
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue