mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-29 08:29:54 +02:00
Imported from ../bash-2.0.tar.gz.
This commit is contained in:
Executable
+25
@@ -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
|
||||
Reference in New Issue
Block a user