WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: rotating 'progress' dash in aterm  (Read 3487 times)

Offline JoXo009

  • Full Member
  • ***
  • Posts: 152
rotating 'progress' dash in aterm
« on: November 13, 2009, 06:30:42 PM »
Once saw code creating a rotating dash in aterm as signal of work in progress.

It was a loop exchanging -,\,|and / sign paused by sleep 1 each.

I need such solution, but couldn't find the old code and created some solution with
echo -ne "^[[1;D" for backspace and
echo -ne "^[[1;A" for cursor up

The backspace solution results in a rotating dash with ugly blinking cursor aside.



As shown obove, the cursor up solution places the cursor away, at the beginning of the line, but always needs to retype the whole line with the rotating dash at its end.

See sample code attached.

I think there might be better solutions. Any hint?

_____________
to download sample code you need to log in

Offline Kingdomcome

  • Sr. Member
  • ****
  • Posts: 286
Re: rotating 'progress' dash in aterm
« Reply #1 on: November 13, 2009, 06:47:57 PM »
The code for the rotating dash in TC is located in /etc/init.d/tc-functions at line 55. You can easily take advantage of that code by sourcing tc-functions in your script. My experience is that the command which you want the rotating dash to be displayed for needs to be backgrounded for things to work right.
An example using the sleep command to have the dash rotate for 10 seconds:
Code: [Select]
#!/bin/sh
. /etc/init.d/tc-functions

sleep 10 &
rotdash $!
« Last Edit: November 13, 2009, 07:13:22 PM by Kingdomcome »

Offline ^thehatsrule^

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 1726
Re: rotating 'progress' dash in aterm
« Reply #2 on: November 17, 2009, 07:55:21 PM »
Just a side note: FYI, these are not aterm specific ;)