Making a executable bash shell script in linux

Permission script

Today, we are going to make a simple executable bash shell script. .sh files are shell executables files, that are used in many variations of UNIX-like operating systems. These scripts are equivalent to the bat files on windows.

How to make a executable bash script ?

We are going to make permission script. This script will provide the right permissions for our laravel project. 🙂

First, let’s create a .sh file . Paste the below code in the file and save naming ‘permission.sh’ or whatever you want to.

This script cannot run right now. We need to make this script executable.

To execute the script, enter the command :

Allright, the script is ready. 🙂 We can add an alias too. Let’s make an alias for that.

Add this at the end of the file:

Now, open a new session terminal or source ~/.bashrc . The alias is ready grant-permission is the name for my alias. You can put whatever name for the alias. The script is ready , you can go to the laravel root folder and hit the alias. This will manage your permission 🙂

If you want to know the commands written on the scripts then, we have an article for this exact commands for you, click here. Happy Coding 🙂

Sharing is caring!

Related Post