MAC 下的简单 SHELL 入门

1、创建文件 .sh 文件

本例,将 sh 文件全名为 demo.sh,接下来使用任意熟悉的编辑器编辑命令即可

2、编写 .sh 文件

#!/bin/sh

echo +----------------------------------------------------------+
echo + A tools for post csdn blogs and input the key as fllow:  +
echo + digg [Digg all blogs]                                    +
echo + views [view all blogs]                                   +
echo + read id [read one blogs]                                 +
echo + exports [exports all blogs]                              +
echo + publish filename [publish blogs]                         +
echo + publishes filename [bat publish blogs]                   +
echo + login account password [login csdn]                      +
echo +----------------------------------------------------------+
printf "Input your order which num is contained on above:"  
read order
php do.php $order

3、执行 sh 文件

执行方式

./demo.sh

不过,在这里,可能会提示无权限,这时需要修改一下文件的权限即可,命令为

chmod 777 run.sh

你可能感兴趣的:(MAC)