1837737 Members
3901 Online
110118 Solutions
New Discussion

Re: Scripting

 
SOLVED
Go to solution
Nobody's Hero
Valued Contributor

Scripting

I have a question that is not that important.
Sometimes when you run an HP script like Q4 for example. you see the dotted lines running accross the page until the procedure finishes.

like '................................................... processing completed.'

Does anyone know how this is scripted? I can echo a line of 'dots'. but I can not get them to proceed one after another. Like I said , not real important, its just bugging me because I can't figure out how to do it.

TIA,

B.
UNIX IS GOOD
12 REPLIES 12
Nobody's Hero
Valued Contributor

Re: Scripting

Or like the rotating slash. I always liked that. Anyone know how to do that?
UNIX IS GOOD
John Poff
Honored Contributor

Re: Scripting

Hi,

Lots of scripts do it like this:

echo ".\c"

The \c tells 'echo' not to append a new-line character at the end of the line. Put that in a loop and you have your dots.

JP
H.Merijn Brand (procura
Honored Contributor

Re: Scripting

Isn't Q$ perl based?

#!/opt/bin/perl

$| = 1;
@mark = qw{ / | \ - };
$i = 100;
while ($i--) {
print $mark[$i % 4], "\r";
for (1..0x5ffff) { 1 } # delay
}
Enjoy, Have FUN! H.Merijn
Stefan Schulz
Honored Contributor

Re: Scripting

Hi,

you could do something like

echo "^H|\c"; sleep 1; echo "^H/\c"; sleep 1 ; echo "^H-\c" and so on.

Put this in a extra script in a loop an run it in the background.

This should give you the rotating slash.

Hope this helps

Regards Stefan
No Mouse found. System halted. Press Mousebutton to continue.
John Palmer
Honored Contributor
Solution

Re: Scripting

Here's a shell script to do the rotating /...

#!/bin/sh

CHAR[0]="|"
CHAR[1]="/"
CHAR[2]="-"
CHAR[3]="\\"

let I=0
print -n " "

while true
do
let N=I%4
let I=I+1
print -n "\010${CHAR[N]}"
sleep 1
done

Regards,
John
Jean-Louis Phelix
Honored Contributor

Re: Scripting

Hi,

And here is a 'launcher' ...

A - sh script called rotate.sh :

#!/usr/bin/sh
while :
do
echo '\\'"\r\c"
sleep 1
echo "|\r\c"
sleep 1
echo "/\r\c"
sleep 1
echo "-\r\c"
sleep 1
done

B - sh script 'go.sh' :

#!/usr/bin/sh
trap 'kill $I ; exit $R' 0 1 2 3 15
rotate.sh &
I=$!
$*
R=$?

C - try it for example using :

go.sh du -ks /usr

Regards.
It works for me (© Bill McNAMARA ...)
justin berkman
Frequent Advisor

Re: Scripting

Here's a shell script to do the rotating /...

#!/bin/sh

CHAR[0]="|"
CHAR[1]="/"
CHAR[2]="-"
CHAR[3]="\\"

let I=0
print -n " "

while true
do
let N=I%4
let I=I+1
print -n "\010${CHAR[N]}"
sleep 1
done
John Palmer
Honored Contributor

Re: Scripting

Nice one Jimmy!

You could have at least have taken the trouble to change some of the variable names.
John Poff
Honored Contributor

Re: Scripting

John,

Imitation is the sincerest form of flattery. Besides, with the timestamp bug on the forum, how do we know you were really first? :)

JP

H.Merijn Brand (procura
Honored Contributor

Re: Scripting

I was. But obviously Robert does not like perl :/
Enjoy, Have FUN! H.Merijn
Pete Randall
Outstanding Contributor

Re: Scripting

At least he didn't cut and paste the


Regards,
John


part.



Pete

Pete
Bill McNAMARA_1
Honored Contributor

Re: Scripting

Can't resist..

Check this one out..

works for me!!

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x276e50011d20d6118ff40090279cd0f9,00.html

Later,
Bill

Nice one jimmy!!
It works for me (tm)