Is there a way to configure bash to automatically insert text at the beginning of each input line? For example, to automatically insert the string 'git ' at the beginning of each input line, to save the user from having to repeatedly type git. This would allow me to create a very minimal git shell, with autocompletion.
Asked
Active
Viewed 254 times
1
jth
- 141
1 Answers
0
Your Enter probably sends Ctrl+m (confirm with Ctrl+v and then Enter, you should see ^M), but Ctrl+j works like Enter as well.
This allows us to solve your problem with one shell command:
bind '"\C-m": "\C-jgit "'
Note: with Backspace or Ctrl+c you can still delete the git string and type any command.
Kamil Maciorowski
- 81,893