博客
关于我
shell练手
阅读量:388 次
发布时间:2019-03-05

本文共 823 字,大约阅读时间需要 2 分钟。

#!/bin/bashecho "Hello World !"name="zhangsan"echo "my name is ${name}a"echo "my name is $namea"# 只读属性 readonly# readonly name# name="Lisi"# echo "edited:${name}"# 删除变量  unset # unset name# echo "deleted $name"# 获取字符串长度  ${#name}echo "name字符串长度:"${#name}string="Hello World"#提取子字符串 ${string:1:4}echo ${string:1:4}#查找子字符串出现位置echo `expr index "$string" o`#-------------------------------------#   #       数组 ,bash仅支持一维数组,不支持多维##--------------------------------------#定义数组people=(    "zhangsan"    "lisi"    "wangwu")#读取数组peopleone=${people[1]}echo $peopleonelength=${#people[@]}echo "数组全部元素:"${people[@]}echo "数组长度:"$length#-------------------------------------#   #       传参#       $n 其中n为数字,用来接收传参,##--------------------------------------echo "传递的第一个参数:"$0echo "传递的第二个参数:"$1echo "所有的参数:"$*echo "当前脚本运行的进程号:"$$echo "所有参数:"$@

转载地址:http://adtwz.baihongyu.com/

你可能感兴趣的文章
Nginx 常用配置清单
查看>>
nginx 常用配置记录
查看>>
nginx 开启ssl模块 [emerg] the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx
查看>>
Nginx 我们必须知道的那些事
查看>>
Nginx 源码完全注释(11)ngx_spinlock
查看>>
Nginx 的 proxy_pass 使用简介
查看>>
Nginx 的 SSL 模块安装
查看>>
Nginx 的优化思路,并解析网站防盗链
查看>>
Nginx 的配置文件中的 keepalive 介绍
查看>>
Nginx 相关介绍(Nginx是什么?能干嘛?)
查看>>
Nginx 知识点一网打尽:动静分离、压缩、缓存、跨域、高可用、性能优化...
查看>>
nginx 禁止以ip形式访问服务器
查看>>
NGINX 端口负载均衡
查看>>
Nginx 结合 consul 实现动态负载均衡
查看>>