How can I make my shell script executable

僤鯓⒐⒋嵵緔 提交于 2019-12-24 08:23:39

问题


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 ?


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/42131982/how-can-i-make-my-shell-script-executable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!