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