Linux运维-shell

shell编程语言是非类型的解释型语言,不需要事先声明变量

echo -e “\033[32m start script… \n------ \033[0m” 显示shell 颜色

shell语法:
#!/bin/bash

定义shell变量:(变量大写)
A=www
echo $A; 输出变量

执行方式:
bash hello.sh
./hello.sh 相对路径或绝对路径
cat hello.sh | bash 这样可以远程调用
curl http_url | bash 远程调用
/bin/bash -x hello.sh 执行调试
/bin/bash -n hello.sh 只能检查语法错误

$$:代表当前shell的pid

if语法
if [ -d $DIR ]; then
else
fi

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值