Shell基础知识

1.Shell简介:

  自动化运维常用的脚本--shell脚本和其他开发语言的脚本

  Shell功能定位: 在计算机学科中, Shell就是一个命令解释器

  Shell分类: 图形界面shell, 命令行式shell

Shell脚本示例:

① 编写脚本itcast.sh
#! /bin/bash
# 这是一个shell脚本文件
echo 'nihao'
echo 'itcast'

② 执行脚本
/bin/bash itcast.sh

 

2.简单实践

执行操作

shell脚本的执行通常可以采用以下几种方式:

常用:   /bin/bash /path/to/script-name 

bash /path/to/script-name 或 /bin/bash /path/to/script-name (强烈推荐使用)
/path/to/script-name 或 ./script-name (当前路径下执行脚本)
source script-name 或 . script-name (注意“.“点号)

 

 

 

posted @ 2020-07-21 20:34  yqyn  阅读(141)  评论(0编辑  收藏  举报