bash autocompletion + command history using sudosh on AIX
2014-07
We configured sudosh on AIX as login shell with /usr/bin/bash as their default shell.
All is working fine except bash autocompletion and command history are not working anymore. TAB is TAB, arrows is cursor up, down, left, right.
Any idea how to get this working?
I don't know sudosh, it seem very old.
First you have to know witch profile to load, is it .profile, .bash_profile, .bashrc ? Can you show us your PATH?
echo $PATH
should return something, if not, that is why the TAB doesn't work.
About the command history, you have to check if you have a .bash_history inside your home directory with the right permission and ownership.
Type this command to see if you have an history :
history
If not, check what i told you.
It can help me if you can post an ls -l inside your home
Should load .bash_profile because bash is configured as default shell.
$ echo $PATH echo $PATH /usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java6/jre/bin:/usr/java6/bin $ history history 1 echo $PATH 2 history 3 ls -la 4 cat /dev/null > .bash_history 5 ls -la 6 exit 7 echo $PATH 8 history $ ls -l ls -l total 0 $ ls -la ls -la total 24 drwxr-xr-x 2 srarol staff 256 Jun 11 09:39 . drwxr-xr-x 14 bin bin 4096 May 15 16:00 .. -rw------- 1 srarol staff 68 Jun 11 09:40 .bash_history -rw-r--r-- 1 srarol staff 255 Jun 11 09:37 .bash_profile >>cat .bash_profile # Local Environment PS1='\[\e[1;36m\]${ORACLE_SID}\[\e[1;35m\] \[\e[1;33m\]\u\[\033[1;35m\]@\[\e[1;32m\]\h\[\e[0m\] $PWD $ ' EDITOR=vi export PS1 EDITOR # vi parameter AIX case `uname` in AIX) EXINIT="set ll=20000000" export EXINIT ;; esac
I like to keep a lot of history, so I have histappend
set in my .bashrc
. Most of the time everything works fine, with history built up from many shells appending. However, every once and a while, I'll start a new shell and find that I've lost the entire history - and it often only contains some of the commands from the last shell to exit (i.e. it's not just overwriting instead of appending). Because of this, I'm suspicious it's happening at shell exit, rather than from some other process killing the .bash_history
file. Supporting this conclusion, I have history command numbers in my prompt, and I've never seen them jump down.
Anyone ever run into a similar problem? Or even just have suggestions how to track down the problem?
No idea why this happens, but maybe you can circumvent the problem by forcing bash to write to its history file each time it displays a prompt:
PROMPT_COMMAND="history -a; history -n"
This will write (-a) and then re-read (-n) the history file each time bash prompts for the next command. Additional benefit: you'll get command X in shell 1 in the history of shell 2.
Sorry to answer my own question, but none of the other answers really address the problem.
I've finally figured out that this only happens when closing gnome-terminal
itself (i.e. file > exit, the 'x' button, alt+F4), and even then generally only when closing several terminals in quick succession. It never happens when using ctrl-D to close the shell, letting the terminal follow.
If I can pin it down well enough, I'll file a gnome-terminal bug report. In the meantime, perhaps this will help some other people who get here from google!
I have seen this happen before but it was a problem with disk errors that were happening in increasing frequency. I would run a scan on the drive. If it turns out the drive is fine, I would check to see if this file is not surpassing an arbitrary shell history limit.
Something that might be able to keep that from happening would be to keep pruning the file back to 80 lines or however many commands you want the history to be.
My experience was that shells updated the history file at exit time. So a shell's initial "history" depended on the most recently exited shell's view of the history.
The result of this is that you can get commands coming and going from the history, depending on how other shells started and stopped.