26 lines
		
	
	
	
		
			546 B
		
	
	
	
		
			Text
		
	
	
	
	
	
		
		
			
		
	
	
			26 lines
		
	
	
	
		
			546 B
		
	
	
	
		
			Text
		
	
	
	
	
	
|   | #!/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 |