Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This is causing commands that 'overflow' a single line to get displayed incorrectly, and it also effects, my bash_history.
I'm guessing that there's a typo in there somewhere, anyone spot it??
Also, I'd like to append the current time (like [02:00]) to the far right of any command I input.
Any quick fixes around?
Thanks
Last edited by hungrigerhaifisch; 10-31-2009 at 08:11 PM.
This is causing commands that 'overflow' a single line to get displayed incorrectly, and it also effects, my bash_history.
I'm guessing that there's a typo in there somewhere, anyone spot it??
Also, I'd like to append the current time (like [02:00]) to the far right of any command I input.
Any quick fixes around?
Thanks
I don't know about the time, but you'll get problems with the prompt if you don't leave "it" with the default colour - i.e. end the prompt with "\[\e[m\]" instead of "\[\e[1;37m\]". If you want the text to be a different colour, there should be a property in your terminal emulator's settings to do that.
Anyone know about the time thing? I saw this on some screenshot somewhere, and I'd really like to try it, so if anyone has an idea, I'd be a happy puppy
Thanks for the tip.
But I still haven't found out how I can do what I want...
Basically I think I saw something like this:
Code:
user wd $ somecommand [current time]
I guess that this would involve somekind of clever scripting, but I'm at a total loss in that area...
EDIT:
I've sadly discovered, that my problem (lines overflowing, this means, when a given line gets to long, it should just wrap around onto the next line, instead it just overwrites my bashpromt) is still there.
I set the color of the hostname according to which drives are mounted: green for pre-production only, yellow for prod and prep, red for production.
"\n> " at the end of the prompt means that I always have an entire line of text to write my commands on... vertical screen real estate isn't as important as getting more of the command on one line.
Oh, by the way, '\e]0;\h \w\007' sets the window title to be my current directory.
Nice idea with the variables, makes things a little simpler
BUT: I'm still having this problem with the 'current-line' getting overwritten should the command become too long. This is highly annoying.
Removing any customisation I've done, results in correct behaviour, so there must me something wrong with those lines...
Nice idea with the variables, makes things a little simpler
BUT: I'm still having this problem with the 'current-line' getting overwritten should the command become too long. This is highly annoying.
Removing any customisation I've done, results in correct behaviour, so there must me something wrong with those lines...
I set the prompt first to "PS1="$username\$ ", which displayed the problem, then to "$wd \$", which did not.
I went on to split apart '\e[0;32m\]\u\[\e[m\]', and then realized that the reason that I saw the problem is not exactly why you saw the problem:
in
Code:
username='\e[0;32m\]\u\[\e[m\]'
, I left off the initial '\['. The pair of '\[' and \]', as I'm sure that you are aware, causes the contents to be counted as non-printable, i.e. 0 length by bash. If you have these unbalanced, Bash apparently doesn't know what's printable and what's not, causes the length of the string to be mis-calculated. Because it doesn't know how long the string is, it doesn't know where to wrap at the end of the line.
I suspect that you have a much more subtle version of the same error lurking in your prompt somewhere, perhaps a '\[' or '\]' that is being masked by an extra escape character or slash, causing an imbalance which throws off the calculated length of the string.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.