From the course: Troubleshooting and Debugging Bash

Automatic code completion - Bash Tutorial

From the course: Troubleshooting and Debugging Bash

Start my 1-month free trial

Automatic code completion

- [Instructor] Automatic code completion should be considered a minimum feature requirement in a text editor intended for coding. Shell scripts require special formatting, and most importantly that there are no hidden characters or line returns within the document that the shell interpreter will encounter at run time. Anything like this will cause your script to behave unexpectedly. This means not using TextEdit in RTF format, but you should go further than just turning off RTF mode in a common text editor, by using a text editor that is intended for programming or scripting. Text editors that are intended for coding will have support for various programming and scripting languages. Many programmer or coding text editors will support code completion in languages like Python and Ruby, and some will also support code completion in scripting languages such as Bash, Zsh, and csh. The nice thing about these is that when you start to type a command that is a known Bash syntax, the text editor will suggest commands that you can select easily, allowing you to avoid typographical errors, and also speeding up your script writing, once you get used to it. When I open a script in an advanced code editor, like VS Code, you can immediately see that there is a difference, as soon as I start typing. In this script, we'll do the typical hello, world function to simply show that we can type and take advantage of automatic code completion. When you start to enter something that the text editor recognizes, the text editor shows you the option that allows you to select it for auto-completion. This is a great way to shortcut through a lot of typing, and to avoid typing errors.

Contents