Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoneybun committed Dec 6, 2023
1 parent 82ed5fc commit 59bdec4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content/bash-scripting-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Open your text editor of choice (I will be using <u>gedit</u>, as it comes with

The line above is the shebang. There are many ways to create scripts, and the shebang will be crucial for the OS to handle your script correctly.

Let's create a directory to save your scripts. This will keep your Home directory tidy, and also keep a dedicated place for things you are working on. In my case, I have chosen to create a directory named `scripts` in my Home Directory. Next, let's save our script that we are writing to this newly created `~/scripts/` directory. You can name this script whatever you like, but for the sake of this tutorial, I am going to name this script `basics.sh`. Note that I gave the file a `.sh` extension. This is not necessary for the script to work, but it will help you as a user know that this is a Bash script because it ends with `.sh`. Other scripting languages use similar naming conventions (Python scripts end with `.py`, or LUA scripts end with `.lua`).
Let's create a directory to save your scripts. This will keep your Home directory tidy, and also keep a dedicated place for things you are working on. In my case, I have chosen to create a directory named `scripts` in my Home directory. Next, let's save our script that we are writing to this newly created `~/scripts/` directory. You can name this script whatever you like, but for the sake of this tutorial, I am going to name this script `basics.sh`. Note that I gave the file a `.sh` extension. This is not necessary for the script to work, but it will help you as a user know that this is a Bash script because it ends with `.sh`. Other scripting languages use similar naming conventions (Python scripts end with `.py`, or LUA scripts end with `.lua`).

The second crucial detail for your OS to properly run your script is to make it executable. As of right now, your script is just a regular text file. In order for your OS to run your script, we will need to make this text file executable. This can be done by navigating to our `~/scripts/` directory with our File Manager. Once you locate your script file, right click on the file to bring up with context menu and select "Properties". This will bring up the various details about the file we are looking at. Click on the tab labelled "Permissions". There will be a checkbox labelled "Allow executing file as program". Make sure to check this box. Once this is enabled, the script will be able to run.

Expand All @@ -40,7 +40,7 @@ At the moment, the script will do nothing if we decided to execute it, so let's
echo "The script executed correctly."
```

We can now attempt to run our script. Open the Terminal from your Application Launcher. I am going to assume that you have followed along and created a directory in your Home Directory called `scripts` and that you have named this script `basics.sh` (if you have placed it in a separate directory or named it differently, the steps are the same, but you must substitute the commands accordingly). First, we need to navigate in our Terminal to our `scripts` directory. Input the following command in your Terminal to change directory to `~/scripts`:
We can now attempt to run our script. Open the terminal from your Application Launcher. I am going to assume that you have followed along and created a directory in your Home directory called `scripts` and that you have named this script `basics.sh` (if you have placed it in a separate directory or named it differently, the steps are the same, but you must substitute the commands accordingly). First, we need to navigate in our Terminal to our `scripts` directory. Input the following command in your Terminal to change directory to `~/scripts`:

```bash
cd ~/scripts
Expand Down

0 comments on commit 59bdec4

Please sign in to comment.