Make an executable Bash Scripts
Since I am using Windows Subsystem for Linux(WSL), I have to constantly run same set of few commands at the start of the Ubuntu and I thought of automating them by executing it as a bash script. Lets see how to create a bash script that can be executed through command line with few key strokes. 1. Create an empty file with .sh extension 2. Add #! /bin/bash to the start of the script followed by the commands you want to execute. Please find the sample file as below 3. Save the file by pressing CTRL+X and press Y and Enter. The file is not yet executable and you can verify by executing ls -lrt command. 4. We can make the script executable by changing the permission by using chmod command as shown below. 5. You can verify whether the file is converted to executable or not by using the ls -lrt command again. The color of the file also will change from WHITE to GREEN as shown below. 6. You can execute the script by issuing the command ./script.sh