projects
/
platform
/
upstream
/
bash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported from ../bash-2.02.tar.gz.
[platform/upstream/bash.git]
/
examples
/
scripts
/
scrollbar
diff --git
a/examples/scripts/scrollbar
b/examples/scripts/scrollbar
index
c177179
..
388bea8
100755
(executable)
--- a/
examples/scripts/scrollbar
+++ b/
examples/scripts/scrollbar
@@
-9,17
+9,17
@@
# converted from ksh syntax to bash v2 syntax by Chet Ramey
WIDTH=${COLUMNS:-80}
# converted from ksh syntax to bash v2 syntax by Chet Ramey
WIDTH=${COLUMNS:-80}
+WMINUS=$(( $WIDTH - 1 ))
[ $# -lt 1 ] && set -- TESTING
[ $# -lt 1 ] && set -- TESTING
-# Posix.2 compatible printf command or bash loadable builtin
-# in examples/loadables/printf
+# use the bash-2.02 printf builtin
Text=$(printf "%-${WIDTH}s" "$*")
Text=$(printf "%-${WIDTH}s" "$*")
-Text=$
(echo "$Text" | tr ' ' '_')
+Text=$
{Text// /_}
while :
do
printf "%-.${WIDTH}s\r" "$Text"
while :
do
printf "%-.${WIDTH}s\r" "$Text"
- LastC=$
(expr "$Text" : '.*\(.\)$')
- Text=
$(printf "%-.${WIDTH}s" "$LastC$Text")
+ LastC=$
{Text:${WMINUS}:1}
+ Text=
"$LastC""${Text%?}"
done
done