1.hello world
在当前文件夹下创建hello.sh,内容如下
运行此脚本 ./hello.sh
chunxiao@master:~/Desktop$ ./hello.sh
hello world
2 定义变量
2.1 整形
参考资料
http://eeepage.info/ubuntu-shell-script-unexpected-operator/
http://rainbird.blog.51cto.com/211214/114362
在当前文件夹下创建hello.sh,内容如下
#!/bin/bash
echo "hello world"
运行此脚本 ./hello.sh
chunxiao@master:~/Desktop$ ./hello.sh
hello world
2 定义变量
2.1 整形
i=5
2.2 字符串
value="abc"
value与=号 = 号与"abc"之间不能有空格
2.3 数组
array=(a b c)
运行时候可能会出现错误 请看 http://eeepage.info/ubuntu-shell-script-unexpected-operator/
参考资料
http://eeepage.info/ubuntu-shell-script-unexpected-operator/
http://rainbird.blog.51cto.com/211214/114362