Linux下sh文件运行及桌面环境双击运行sh文件

sh文件运行:

1、修改为可执行权限:

chmod u+x hello.sh

2、运行

./hello.sh

3、不使用可执行权限修改,用sh直接运行

sh ./hello.sh

桌面环境双击运行sh文件:

Mac:

1、修改后缀sh变成command:hello.sh->hello.command

2、修改可执行权限:chmod u+x hello.command

Ubuntu:

1、修改可执行权限:chmod u+x hello.sh

2、任意打开一个文件夹,选择左上角的【编辑】->【首选项】

选择【打开可执行文本文件时运行它们】即可实现双击运行。

 

参考:

http://blog.csdn.net/lipeiran1987/article/details/18406535

http://www.cnblogs.com/jackchiang/p/4676984.html

posted @ 2017-09-02 19:15  EasonJim  阅读(13008)  评论(0编辑  收藏  举报