Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[OT] [Script] Kommando-Zeile überschreiben [solved]
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum
View previous topic :: View next topic  
Author Message
leuenberger
Tux's lil' helper
Tux's lil' helper


Joined: 13 Jul 2003
Posts: 147
Location: Zurich, ZH, Schweiz

PostPosted: Sun Jul 11, 2004 1:03 pm    Post subject: [OT] [Script] Kommando-Zeile überschreiben [solved] Reply with quote

Hallo zusammen

Ich möchte in einem Programm (Bash oder Perl) eine ausgegebene Zeile wieder überschreiben lassen.

Dazu habe ich "Quick and Dirty" ein kleines Bash-Script geschrieben:

Code:
i=0

while [ "1" ]
do
   printf "%8d" $i
   ((i++))
   sleep 1
   echo -e -n "\b\b\b\b\b\b\b\b"
done


Dieses Programm funktioniert nur auf der aktuellen Zeile. Ich habe mir den Source von eupdatedb aus esearch angeschaut, aber irgendwie habe ich Python nicht verstanden.

Die Ausgabe sollte folgendermassen aussehen:
Code:
 10% bearbeitet
[der Curser steht auf der neuen Zeile]


Nächste Anzeige (wobei natürlich die vorhergehende Ausgabe nicht mehr sichtbar sein sollte...):
Code:
 11% bearbeitet
[der Curser steht auf der neuen Zeile]


Wie stelle ich es an, dass ich auch ganze Zeilen überschreiben kann?

Gruss Reto


Last edited by leuenberger on Mon Jul 12, 2004 7:43 am; edited 1 time in total
Back to top
View user's profile Send private message
lostSoul
Tux's lil' helper
Tux's lil' helper


Joined: 26 Oct 2002
Posts: 125
Location: /earth/germany/bielefeld

PostPosted: Sun Jul 11, 2004 1:17 pm    Post subject: Reply with quote

Wenn das einer für Perl weiss, bitte posten :wink:
Back to top
View user's profile Send private message
_hephaistos_
Advocate
Advocate


Joined: 07 Apr 2004
Posts: 2694
Location: salzburg, austria

PostPosted: Sun Jul 11, 2004 1:18 pm    Post subject: Reply with quote

hallo,

ja glaub auch, dass das nicht einfach wird...
normalerweise gibts doch ncurses für sowas oder?

ciao
Back to top
View user's profile Send private message
leuenberger
Tux's lil' helper
Tux's lil' helper


Joined: 13 Jul 2003
Posts: 147
Location: Zurich, ZH, Schweiz

PostPosted: Sun Jul 11, 2004 1:29 pm    Post subject: Reply with quote

Ich weiss, aber ich wollte ncurses eigentlich vermeiden... :oops:
Back to top
View user's profile Send private message
Deever
Veteran
Veteran


Joined: 06 Jul 2002
Posts: 1354
Location: Zürich / Switzerland

PostPosted: Sun Jul 11, 2004 5:31 pm    Post subject: Reply with quote

Bist du sicher, dass du den Cursor unbedingt auf der neuen Zeile haben willst? Macht mir nämlich IMHO nicht wirklich Sinn...;)

Gruß && HTH!
/dev
Back to top
View user's profile Send private message
_hephaistos_
Advocate
Advocate


Joined: 07 Apr 2004
Posts: 2694
Location: salzburg, austria

PostPosted: Sun Jul 11, 2004 5:38 pm    Post subject: Reply with quote

Deever wrote:
Macht mir nämlich IMHO nicht wirklich Sinn...;)

hallo,

ich glaub er will so eine Art "Processing" Leiste (wie wenn du was mit emerge/wget runterlädst -> dann ändern sich die Prozentanzeigen, aber alles in einer Zeile)....

macht also schon Sinn finde ich :)
Back to top
View user's profile Send private message
leuenberger
Tux's lil' helper
Tux's lil' helper


Joined: 13 Jul 2003
Posts: 147
Location: Zurich, ZH, Schweiz

PostPosted: Sun Jul 11, 2004 7:45 pm    Post subject: Reply with quote

@hephaistos6
Vielen Dank für den Support. Ich hatte wirklich einige Problem mein Problem zu beschreiben!?! :oops:

@Deever
Natürlich muss der Cursor nicht unbedingt auf der neuen Zeile sein. Ich wollte einfach mal fragen, ob jemand eine Lösung für das Problem kennt... 8)
Back to top
View user's profile Send private message
Deever
Veteran
Veteran


Joined: 06 Jul 2002
Posts: 1354
Location: Zürich / Switzerland

PostPosted: Sun Jul 11, 2004 8:12 pm    Post subject: Reply with quote

leuenberger wrote:
@Deever
Natürlich muss der Cursor nicht unbedingt auf der neuen Zeile sein. Ich wollte einfach mal fragen, ob jemand eine Lösung für das Problem kennt... 8)

Wo liegt dann das Problem?
Code:
for (( i=0; i<10; i++ )) {
   printf "\r%2d" i+1
   sleep 1}
echo -n "\n"


Gruß,
/dev
Back to top
View user's profile Send private message
leuenberger
Tux's lil' helper
Tux's lil' helper


Joined: 13 Jul 2003
Posts: 147
Location: Zurich, ZH, Schweiz

PostPosted: Sun Jul 11, 2004 8:41 pm    Post subject: Reply with quote

OK! jetzt wo ich es weiss, kann ich es ja sagen: ich habe nach \r gesucht... :wink:

Vielen Dank für die Hilfe.

Gruss Reto
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum