如何使我的Shell脚本可执行 [英] How can I make my shell script executable

查看:103
本文介绍了如何使我的Shell脚本可执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个Shell脚本,其中打开了一些目录并运行了一些脚本,我通过终端运行了这个bash文件(bash filename.sh),如何使其可单击?

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 ?

推荐答案

您首先需要使用以下脚本启动脚本

You first need to start your script with

'#!/bin/bash'

'#!/bin/bash '

,并将其另存为< 文件名>.sh.另外,请确保将权限保留为a + x,即所有用户都可以执行该脚本.

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.

这篇关于如何使我的Shell脚本可执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆