Bash shell problem on Fedora Linux


 
Thread Tools Search this Thread
Operating Systems Linux Fedora Bash shell problem on Fedora Linux
# 1  
Old 12-24-2017
Bash shell problem on Fedora Linux

My shell environment is bash and desktop environment is LXDE. When I use the up and down button on the keyboard to view the command history on bash shell, many times part of the command from the history remains on the line. For example
Code:
/home/milhan > ssh somedomain.org
/home/milhan >

then when I traverse the history of commands with up arrow key and come back to command prompt, the prompt looks like
Code:
/home/milhan > ssh

and when I press backspace it doesn't delete the ssh. I wasn't able to figure this out for long time. This only happens on my local machine. I ssh to other remote Unix machines where I use bash, but the same annoyance doesn't happen on those machines. I use QTerminal 0.7.1 and the default LXTerminal on my local Fedora Linux pc. Thanks.
# 2  
Old 12-25-2017
I am guessing: On the problem box, there is a spurious non-printing character in the environment variable(s) you have defined. I do not know what you have defined, but if you have local (Ex: .bashrc) files or other "hidden" files sprinkled around you have to validate them to locate where you picked up the garbage.

Start with your home directory.

Code:
set | od -c   # check your existing variables for junk
od -c [ .filename ]   # check your initialization and setup files

# 3  
Old 12-25-2017
Is that only for that ssh command line, or for other commands / history lines as well?
# 4  
Old 12-25-2017
Quote:
Originally Posted by RudiC
Is that only for that ssh command line, or for other commands / history lines as well?
That's hard to say. The above example was just to illustrate the problem. It doesn't do it for every command and when it does, it is always 3 characters. For example, I just tested and the gre from a previous grep command was left in the command prompt.

---------- Post updated at 13:17 ---------- Previous update was at 12:23 ----------

Quote:
Originally Posted by jim mcnamara
I am guessing: On the problem box, there is a spurious non-printing character in the environment variable(s) you have defined. I do not know what you have defined, but if you have local (Ex: .bashrc) files or other "hidden" files sprinkled around you have to validate them to locate where you picked up the garbage.
Code:
/home/milhan > env
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.m4a=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.oga=01;36:*.opus=01;36:*.spx=01;36:*.xspf=01;36::ex=0;35:
_LXSESSION_PID=1786
XDG_CONFIG_HOME=/home/milhan/.config
PREFERRED=/usr/bin/startlxde
XDG_MENU_PREFIX=lxde-
LANG=en_US.UTF-8
HISTCONTROL=ignoredups
DISPLAY=:0.0
HOSTNAME=dellwstation
INVOCATION_ID=0d56a9429cc842f4ba3d84cef4f215bc
IMSETTINGS_INTEGRATE_DESKTOP=yes
KDEDIRS=/usr
XDG_VTNR=1
SSH_AUTH_SOCK=/tmp/ssh-jRqaTqmojPjF/agent.1786
XDG_SESSION_ID=3
USER=milhan
DESKTOP_SESSION=LXDE
IMSETTINGS_MODULE=none
PWD=/home/milhan
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HOME=/home/milhan
JOURNAL_STREAM=9:28758
SSH_AGENT_PID=1939
XDG_DATA_DIRS=/usr/local/share:/usr/share:/usr/share/gdm:/var/lib/menu-xdg
SAL_USE_VCLPLUGIN=gtk
MAIL=/var/spool/mail/milhan
TERM=xterm
SHELL=/bin/bash
GNOME_KEYRING_CONTROL=/home/milhan/.cache/keyring-VS1SBZ
QT_IM_MODULE=xim
XMODIFIERS=@im=none
XDG_CURRENT_DESKTOP=LXDE
XDG_SEAT=seat0
SHLVL=2
COLORFGBG=15;0
LANGUAGE=
WINDOWID=0
LOGNAME=milhan
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
XDG_RUNTIME_DIR=/run/user/1000
XAUTHORITY=/home/milhan/.Xauthority
XDG_DATA_HOME=/home/milhan/.local/share
XDG_CONFIG_DIRS=/etc/xdg
PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/milhan/bin:
PS1=\e[0;32m\n`whoami`@`uname -n | cut -d "." -f 1 ` :: `echo "$(date) $QUOTE"`\n`pwd` >\e[m 
HISTSIZE=
LESSOPEN=||/usr/bin/lesspipe.sh %s
GTK_IM_MODULE=gtk-im-context-simple
_=/bin/env

# 5  
Old 12-26-2017
It's the three non-printing terminal reset characters at the end of the PS1 string that increase the char count output and thus the "length" of the prompt string that the shell takes into account. Try embedding those by enclosing in the correct codes. man bash:

Quote:
PROMPTING
.
.
.
\[ begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
\] end a sequence of non-printing characters
This User Gave Thanks to RudiC For This Post:
# 6  
Old 12-26-2017
Thanks, problem fixed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash Shell Linux

I have a csv file that looks like this Name,Food,Sport James,Curry,Gym Darren,Pizza,Football Jim,Fish,Hockey James,Sushi,Tennis My code looks like this IFS="," sed 1d $file_name | while read Name Food Sport do mkdir -p $Name #echo "==================" #echo "Name: $Name" (3 Replies)
Discussion started by: darklord173
3 Replies

2. Shell Programming and Scripting

Initialize file name bash shell - Linux

I am trying to initialize a file name in bash but not having much luck. For example, one of my bash scripts outputs a file named "FILE_1000G.vcf". I would like to rename FILE to match with the user's name. This is my code: set -e echo "Please enter your filename:" read filename rename... (6 Replies)
Discussion started by: Geneanalyst
6 Replies

3. Shell Programming and Scripting

UNIX Korn Shell to Linux Bash

Migrating Unix batch jobs (Korn Shell) running in HP-UX server to Linux environment. Hi All Please help me to understand the easiest way to migrate Kernel Shell scripts to Linux Bash. Also let me know 1. Any automated scripts or tools available for this. 2. Challenges and issues... (5 Replies)
Discussion started by: cpremesh
5 Replies

4. Shell Programming and Scripting

problem with rsh in bash shell

Hello All, I am trying to gather output of df -k from remote server to local server using below line: rsh <host> df -k >/tmp/space_remote_host.txt Why above throws following error message:(I've deleted the IP address in below chunk) connect to address ..: Connection refused Trying... (2 Replies)
Discussion started by: InduInduIndu
2 Replies

5. Homework & Coursework Questions

LINUX Bash Shell Script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a bash shell script that presents work information of employees of a department from a company data... (1 Reply)
Discussion started by: help123
1 Replies

6. Shell Programming and Scripting

PLEASE HELP! LINUX BASH SHELL SCRIPT

PLEASE HELP! NEED LINUX SCTIPT Need to write a bash shell script to show information of employees of a department from a company data set. The script should accept a project number (1/2/3/10/20/30) and output * the name of the project * the name of the manager of the controlling... (1 Reply)
Discussion started by: help123
1 Replies

7. Shell Programming and Scripting

Problem with bash shell script program

Hi, This is my program. #!/bin/bash today=`date +"%b-%d-%Y"` SERVICE="pbxconnect.php" if ; then echo "pbx program is running" else nohup php pbxconnect.php > logpbx-$today.txt & fi On executing using "sh myprogram.sh" , i get the following error. myprogram.sh: line 4: ' My... (7 Replies)
Discussion started by: gskumar1234
7 Replies

8. Shell Programming and Scripting

rm:command not found in linux Bash shell script

Hi All, Linux lxs3er06 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:58:04 EST 2007 i686 i686 i386 GNU/Linux Issue: While executing shell scripts in bash shell, following error messages are thrown: rm:command not found On doing little investigation, I added '/bin' to $PATH and on doing echo... (9 Replies)
Discussion started by: a1_win
9 Replies

9. Shell Programming and Scripting

problem using arrow keys in bash shell

hello everybody, as many, I have a problem with a script... I wrote a shell script in which I want to read a variable value. the problem is that I can't use the arrow keys. Here is the script I use : #!/bin/bash stty erase ^H read foune echo "$foune" exit 0; the problem is... (2 Replies)
Discussion started by: Moumou
2 Replies

10. Shell Programming and Scripting

problem with while loop in BASH shell

I have file named script1 as follows: #!/bin/bash count="0" echo "hello" echo "$count" while do echo "$count" count=`expr $count + 1` done ----------- when I run it, I get ./script1: line 9: syntax error near unexpected token `done' ./script1: line 9: `done' I... (6 Replies)
Discussion started by: npatwardhan
6 Replies
Login or Register to Ask a Question