How can I make my shell script executable

2019-07-28 09:34发布

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

2条回答
Juvenile、少年°
2楼-- · 2019-07-28 09:51

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.

查看更多
小情绪 Triste *
3楼-- · 2019-07-28 09:59

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

查看更多
登录 后发表回答