Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

KSH scripting in slit terminal

Status
Not open for further replies.

minixman

Technical User
Dec 10, 2002
3
US
hi all

i am trying to have a screen print 2 results at the same time, for example.

while true do
echo "Hello world"
done

then whilst that is running, have a progress bar that prints
1%, then clear results
2 % on the same line, anyone been able to do this

 
something like that might be a start:

#!/bin/ksh

typeset -i everyLine=5
typeset -i i=0

while (( (i=$((i+1))) < 10000 ))
do
(( i % everyLine == 0 )) && print -n &quot;\r${i}&quot;
done

echo &quot;&quot;
vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Thanks for the Counter, that is cool, but what i am trying to do is

in the same terminal window or program window, have the counter running like so, and also lets say have a ps -ef|grep cp running in a while loop, so it would look something like this on your screen


bash%: ./runprog

1 secs

----

root : root /user/bin/cp program-program

and then the seconds would update until the cp has finished like 2,3,4,5,5,6



 
look into using &quot;tput&quot; for &quot;addressable cursors&quot;.
you'll also need to look into starting the 'cp' in the background and 'scheduling' your 'ps|grep' [grepping for the backgrounded 'cp' pid].

work on the cp/grep/background 'thingies' first and address a 'split screen/tput' issues later. vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top