Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make my shell script executable

I wrote a shell script which opens some directories and runs some script, I run this bash file by terminal (bash filename.sh), how can I make it clickable?

like image 887
Mahbod Mousavi Avatar asked May 10 '26 12:05

Mahbod Mousavi


2 Answers

You need to add the following shebang line to the top of your code.

#!/bin/bash

You also need to ensure that the script has executable permissions by running:

chmod a+x <filename>.sh

like image 94
Aaron Sutton Avatar answered May 13 '26 02:05

Aaron Sutton


You first need to start your script with

'#!/bin/bash '

and save it as <filename>.sh Also make sure that you keep the permissions as a+x i.e all users can execute the script.

like image 22
Niceha Avatar answered May 13 '26 01:05

Niceha