美文网首页
mac shell编程

mac shell编程

作者: f09037cb27f7 | 来源:发表于2018-02-02 14:33 被阅读8次

1、建立 ".sh" 文件,helloworld.sh

#!/bin/bash
echo Hello World!!!

2、修改文件的权限,使脚本具有执行权限

chmod 777 helloworld.sh

3、输入./helloworld.sh 即可运行文件
注意,一定要写成 ./helloworld.sh,而不是 helloworld.sh,运行其它二进制的程序也一样,直接写 helloworld.sh,linux 系统会去 PATH 里寻找有没有叫 helloworld.sh 的,而只有 /bin, /sbin, /usr/bin,/usr/sbin 等在 PATH 里,你的当前目录通常不在 PATH 里,所以写成 helloworld.sh 是会找不到命令的,要用 ./helloworld.sh 告诉系统说,就在当前目录找。


#!/bin/bash
# 执行一个PHP程序
cd /Users/xiao/php
php line_count.php
#!/bin/bash
# 打开微信,停止2秒,打开qq程序
open /Applications/WeChat.app
sleep 2s
open /Applications/QQ.app
# 打开QQ浏览器,并跳转到Python下载页面
open -a "/Applications/QQBrowser.app" https://www.python.org/downloads/

相关文章

  • mac终端下运行shell脚本

    From: 在mac下编写shell脚本并执行 一些资料 Shell教程-for 菜鸟教程 Shell脚本编程30...

  • mac shell编程

    1、建立 ".sh" 文件,helloworld.sh 2、修改文件的权限,使脚本具有执行权限 chmod 777...

  • shell 案例

    Shell编程一 Shell防范ARP攻击 Shell编程二 Shell防范DDos攻击 Shell编程三 ...

  • 把IDEA的终端改为Shell编辑器

    编程一段时间,相信你会喜欢用shell,然后windows,mac或linux都想用用shell所以我就有了这个变...

  • shell 第一天

    shell编程初识 1.1 shell编程初识 shell的定义 Shell 是命令解释器 Shell 也是...

  • 78.shell编程

    shell编程 Shell脚本,是一种为shell编写的脚本程序。 Shell编程跟JavaScript、Pyth...

  • 2019-01-25

    Linux系统Shell编程指南 前言 适合人群:有类似C编程基础的人 一、Shell编程介绍 Shell解释型语...

  • day 28

    shell编程基础 shell编程一小时光速入门web集群架构会用到shell编程基础 1、为什么要学shell编...

  • Shell 编程的 Hello World

    什么是 Shell?简单来说,Shell 编程是对 Linux 命令的逻辑化处理。 来看看 Shell 编程是如何...

  • Shell 编程的 Hello World

    什么是 Shell?简单来说,Shell 编程是对 Linux 命令的逻辑化处理。 来看看 Shell 编程是如何...

网友评论

      本文标题:mac shell编程

      本文链接:https://www.haomeiwen.com/subject/qxeszxtx.html