You are not logged in.

#1 2013-01-08 22:07:34

[L3Le]
Member
Registered: 2010-05-07
Posts: 3

Battery script in bash prompt not working properly

here is my bashrc and my script:
http://pastebin.com/pDNV3kpQ

everything seems to be working properly but when in the prompt the command I'm writing wraps to the next line after a few charachters it starts overlapping itself (like in word when you press the "ins" button). I've been trying to figure out what the problem is for hours, but I failed. Please, can anyone help me?

thanks in advance...

EDIT: I think that the problem is in the script, if I comment the first line the problem disappears, and it also disappears if I manually set the "BATTERY" variable to a low number, e.g. 1.
For values higher than 20 and 50, when the yellow/pink color comes out, the problem appears again.
I also noticed that if I comment all the if statements and leave only the last color (which would be supposed to work) it doesn't, even if I leave BATTERY set to 1.

Last edited by [L3Le] (2013-01-08 22:25:07)

Offline

#2 2013-01-08 22:17:59

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,571
Website

Re: Battery script in bash prompt not working properly

You're enclosing both the battery color and the battery value in \[...\] so readline doesn't count the battery characters.

Only the color codes should be enclosed in \[...\]


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Online

#3 2013-01-08 22:26:01

[L3Le]
Member
Registered: 2010-05-07
Posts: 3

Re: Battery script in bash prompt not working properly

so how can I pass the battery value to te PS1?

EDIT: I created another script. It seems to work!!! Thanks a lot, you saved my evening smile

Last edited by [L3Le] (2013-01-08 22:30:00)

Offline

Board footer

Powered by FluxBB