long command line is wrapped at the beginning of the same line
I tried to change COLUMNS and added "export COLUMNS=250"
in my .bash_profile. but after re-login, suppose it will pick up the updated COLUMNS variable, but it didn't. I did source the .bash_profile again, then the variable is updated. But when I use "set" command, it is still the old value. I don't know where 65 is set. and when I resize the terminal window, this value keeps changing. Can somebody explain this to me? Thanks, after re-login [ipbx@lab33 ~]$ printenv COLUMNS 65 [ipbx@lab33 ~]$ echo $COUMNS [ipbx@lab33 ~]$ echo $COLUMNS 65 [ipbx@lab33 ~]$ set|grep COLUMNS COLUMNS=65 [ipbx@lab33 ~]$ . ~/.bash_profile [ipbx@lab33 ~]$ echo $COLUMNS 250 [ipbx@lab33 ~]$ printenv COLUMNS 250 [ipbx@lab33 ~]$ set|grep COLUMNS COLUMNS=65 _=COLUMNS [ipbx@lab33 ~]$ set|grep COLUMNS COLUMNS=65 [ipbx@lab33 ~]$ set COLUMNS=250 [ipbx@lab33 ~]$ set|grep COLUMNS COLUMNS=94 _=COLUMNS=250 [ipbx@lab33 ~]$ set|grep COLUMNS COLUMNS=94 [ipbx@lab33 ~]$ set|grep COLUMNS COLUMNS=94 [ipbx@lab33 ~]$ set|grep COLUMNS COLUMNS=126 |
If you're using bash shell, append this variable in .bashrc or in .profile, as:
Code:
COLUMNS=250; export COLUMNS Code:
source .bashrc Code:
echo $COLUMNS |
There's no point in setting this variable, it is (re)set by bash itself. From the man page:
Quote:
Did you try this to solve the wrapping problem or did it introduce it? |
Code:
shopt -s checkwinsize |
to Drunna's questions,
I was trying to solve the wrapping problem by resetting "COLUMNS". and I am using bash. What does "shopt -s checkwinsize" do? WILL that solve the wrapping problem? |
Quote:
|
I believe there's some miscommunication at work here. I, and probably most of the others, don't understand what the "wrapping" trouble actually is, and why you think you have to mess with the COLUMNS variable to fix it.
Could you please explain exactly what your problem is, in detail? And please use ***[code][/code]*** tags around your code and data, to preserve the original formatting and to improve readability. Do not use quote tags, bolding, colors, "start/end" lines, or other creative techniques. edit: After reading the title again a couple of times, I think druuna may be right, and you have a mis-configured prompt. If there are unprotected non-printing characters involved, you often get behavior like lines wrapping back upon themselves. So if you've changed something in your PS1 variable, please post it (in code tags, naturally). |
Sorry about the confusion. At first, I thought that changing COLUMNS may solve the problem. But it didn't.
I didn't change PS1. Here is my PS1 value. Code:
lwang@california:~/project/aurra$ set|grep PS1 |
for example,
Code:
19.ng@california:~/project/aurra$ scp packages/intraswitch-SP13.0.3-sp-linux.tgz lwang@192.84. |
Quote:
Set shopt -s checkwinsize in your /etc/bash.bashrc (or similar for your distro) to make it global or put it in ~/.bashrc to make it local. |
I tried "shopt -s checkwinsize", the wrapping didn't work immediately. After I re-size the window to smaller size, the long command was wrapped to the next line afterwards.
I looked at another shell, checkwinsize was on by default. So I am not sure if "shopt -s checkwinsize" helped. I am going to add this shopt to my .bashrc anyway to see if I will run into the same problem again. Thanks for help. |
All times are GMT -5. The time now is 08:47 PM. |