O'Reilly logo

Mastering Linux Shell Scripting, by Andrew Mallett, Mokhtar Ebrahim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating snippets using VS Code

For those who love graphical IDEs, you can use VS Code as an editor for your shell scripts. We used it as a debugger in Chapter 1, The What and Why of Scripting with Bash. Now we will see one of its capabilities as an editor.

You can create your own snippets in VS Code as follows.

Navigate to File | Preferences | User Snippets.

Then start to type shell. This will open the shellscript.json file.

The file has two brackets ready to enter your snippets between them:

To create a snippet, type the following between the brackets on the file:

"Print a welcome message": {   "prefix": "welcome",   "body": [ "echo 'Welcome ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required