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