Fix bind warning in .profile on login in Ubuntu
Recently I moved back to bash as my default shell. I was previously using fish and got used to the cool features it has. But, regardless of that, I wanted to move to a more standard shell because I was hopping back and forth with exporting variables and stuff like that which got pretty annoying.
So I embarked on a mission to make bash more like fish and in the process found that I really missed autosuggest with TAB on changing directories.
I found a nice alternative that emulates zsh like
autosuggestion and autocomplete so I added the following to my .bashrc
file.
bind "TAB:menu-complete"
bind "set show-all-if-ambiguous on"
bind "set completion-ignore-case on"
bind "set menu-complete-display-prefix on"
bind '"\e[Z":menu-complete-backward'
I haven't noticed anything wrong with this and all was working fine until I restarted my machine and then I got this error.
When I pressed OK, I got into the Gnome shell and all was working fine, but the error was still bugging me. I started looking for the reason why this is happening and found a solution to this error on Remote SSH Commands - bash bind warning: line editing not enabled.
So I added a simple if [ -t 1 ]
around bind
statements to avoid running
commands that presume the session is interactive when it isn't.
if [ -t 1 ]; then
bind "TAB:menu-complete"
bind "set show-all-if-ambiguous on"
bind "set completion-ignore-case on"
bind "set menu-complete-display-prefix on"
bind '"\e[Z":menu-complete-backward'
fi
After logging out and back in the problem was gone.
Other posts
- Using sentiment analysis for clickbait detection in RSS feeds
- The abysmal state of GNU/Linux and a case against shared object libraries
- Using custom software with Github Actions to deploy a site
- Getting started with MicroPython and ESP8266
- Simple Server-Sent Events based PubSub Server
- I think I was completely wrong about Git workflows
- Trying to build a New kind of terminal emulator for the modern age
- Software development and my favorite pitfalls
- Profiling Python web applications with visual tools
- Debian based riced up distribution for Developers and DevOps folks
- My journey from being an internet über consumer to being a full hominum again
- Who knows what the world will look like tomorrow
- Converting Valgrind callgrinds to SVG format
- What would DNA sound if synthesized to an audio file
- Disable mouse wake from suspend with systemd service