aboutsummaryrefslogtreecommitdiff
path: root/content/posts/2020-09-08-bind-warning-on-login.md
diff options
context:
space:
mode:
authorMitja Felicijan <m@mitjafelicijan.com>2023-07-12 18:35:08 +0200
committerMitja Felicijan <m@mitjafelicijan.com>2023-07-12 18:35:08 +0200
commit23a56bd50b04211da3cab45f72c3390711b2416b (patch)
treeab9a4a0136b4cce06dba7d853e296f682f807dbb /content/posts/2020-09-08-bind-warning-on-login.md
parentcecb4b48a39a3558979b9c4b50e45bf605a3684e (diff)
downloadmitjafelicijan.com-23a56bd50b04211da3cab45f72c3390711b2416b.tar.gz
Moved notes and posts into subfolders
Diffstat (limited to 'content/posts/2020-09-08-bind-warning-on-login.md')
-rw-r--r--content/posts/2020-09-08-bind-warning-on-login.md54
1 files changed, 54 insertions, 0 deletions
diff --git a/content/posts/2020-09-08-bind-warning-on-login.md b/content/posts/2020-09-08-bind-warning-on-login.md
new file mode 100644
index 0000000..f213cd9
--- /dev/null
+++ b/content/posts/2020-09-08-bind-warning-on-login.md
@@ -0,0 +1,54 @@
1---
2title: Fix bind warning in .profile on login in Ubuntu
3url: bind-warning-on-login-in-ubuntu.html
4date: 2020-09-08T12:00:00+02:00
5type: post
6draft: false
7---
8
9Recently I moved back to [bash](https://www.gnu.org/software/bash/) as my
10default shell. I was previously using [fish](https://fishshell.com/) and got
11used to the cool features it has. But, regardless of that, I wanted to move to a
12more standard shell because I was hopping back and forth with exporting
13variables and stuff like that which got pretty annoying.
14
15So I embarked on a mission to make [bash](https://www.gnu.org/software/bash/)
16more like [fish](https://fishshell.com/) and in the process found that I really
17missed autosuggest with TAB on changing directories.
18
19I found a nice alternative that emulates [zsh](http://zsh.sourceforge.net/) like
20autosuggestion and autocomplete so I added the following to my `.bashrc` file.
21
22```bash
23bind "TAB:menu-complete"
24bind "set show-all-if-ambiguous on"
25bind "set completion-ignore-case on"
26bind "set menu-complete-display-prefix on"
27bind '"\e[Z":menu-complete-backward'
28```
29
30I haven't noticed anything wrong with this and all was working fine until I
31restarted my machine and then I got this error.
32
33![Profile bind error](/assets/profile-bind-error/error.jpg)
34
35When I pressed OK, I got into the [Gnome
36shell](https://wiki.gnome.org/Projects/GnomeShell) and all was working fine, but
37the error was still bugging me. I started looking for the reason why this is
38happening and found a solution to this error on [Remote SSH Commands - bash bind
39warning: line editing not enabled](https://superuser.com/a/892682).
40
41So I added a simple `if [ -t 1 ]` around `bind` statements to avoid running
42commands that presume the session is interactive when it isn't.
43
44```bash
45if [ -t 1 ]; then
46 bind "TAB:menu-complete"
47 bind "set show-all-if-ambiguous on"
48 bind "set completion-ignore-case on"
49 bind "set menu-complete-display-prefix on"
50 bind '"\e[Z":menu-complete-backward'
51fi
52```
53
54After logging out and back in the problem was gone.