Insert tab characters in Bash

Since tab completion is usually enabled in the Bash shell, you can not insert the tab character itself. While typing a single tab character is easy — just hit Ctrl-V and then Tab ⇆ — this doesn't work when pasting a script. The solution: run ~$ bind "set disable-completion on" and then paste the stuff. To enable tab completion again, run ~$ bind "set disable-completion off"

(Actually, this is not really a Bash problem, but rather a readline problem, and Bash's bind builtin just changes the readline setting. If you want to disable tab completion completely, you can add the line set disable-completion on to your ~/.inputrc file.)

» main » bash

Page content licensed under a Creative Commons BY-NC-SA license (deutsche Version).