Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, I have written a cp progress bar that gives out the % of completion, but there is a slight hitch... I am unable to get the numericals at ...
  1. #1
    Just Joined!
    Join Date
    May 2008
    Posts
    20

    % encounter at the same place, how to?

    Hi all,

    I have written a cp progress bar that gives out the % of completion, but there is a slight hitch...
    I am unable to get the numericals at the same place, meaning 1% changing over to 2 ,then 2 to 3 so on...
    The bar that i have now will actually print something like this
    1% ,2% .......100%.
    But this is not what i want....i want a change over rather than a lead in...
    Could you please help me figure out a way to escape this?

    Thanks

  2. #2
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Have you tried using backspace characters (x08 ) before outputting, to backup the cursor and overwrite the extant text?

  3. #3
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    scm is right on the dot! In fact, there's even a backslash escape to do it for you (\b).

    To illustrate, just do this:
    Code:
    echo -e "a\bc"
    echo will print "a", then a backspace (deleting the "a"), and then a "c".

    Easy peasy!
    DISTRO=Arch
    Registered Linux User #388732

  4. #4
    Just Joined!
    Join Date
    May 2008
    Posts
    20
    ok, Thanks
    I will try it out and let you know!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...