Your first script
To begin, open the VS code then see the video below for setup instructions to create a folder
Creating a new folder
To create a file in Vscode use can use either of the following approaches.
Method 1
The following video instruction walks you through how to create files in Vscode.
Method 2
Press Command + ` on macOS, the ` key is usually under the Esc key.
For windows users, press the windows key Win + `. The command will open the Vscode integrated terminal, from where you can create a new file.
With that out of the way, let's go on to our first script.
Writing our first script
Create a file named hello
manually or use the touch command. Yes, some programmers prefer to use the .sh
extension for their scripts, such as hello sh
, it is not required, and we'll not be doing that. In the newly created file, add the following content.
#!/bin/bash
echo "Hello, World"
From the terminal, execute sh hello
.
This prints Hello world
to the terminal.
% sh hello
Hello, World