(一)shell脚本入门

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”

运行

 

原文地址:https://www.cnblogs.com/hg-super-man/p/10513391.html