shell 脚本入门
1, 脚本格式
脚本以 #!/bin/bash 开头 (指定解析器)
2, 第一个 shell 脚本: helloworld
(1) 需求: 创建一个 shell 脚本, 输出 helloworld
运行: sh helloworld.sh
注意:
第一种: 采用 bash/sh + 脚本的相对路径或者绝对路径 (不用赋予脚本 + x 权限)
第二种: 采用输入脚本的绝对路径或相对路径执行脚本 (必须具有可执行权限 + x )
chmond 777 ./helloworld.sh(颜色都会变化)
3, 第二个 shell 脚本
(1) 需求:
在 / study/shell 目录下创建一个 banzhang.txt, 在 banzhng.txt 文件中增加 "I LOVE U"
运行
来源: http://www.bubuko.com/infodetail-2984342.html