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

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

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

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

你可能感兴趣的文章
Qt笔记——模型/视图MVD 文件目录浏览器软件
查看>>
POJ 2892 Tunnel Warfare(树状数组+二分)
查看>>
poj 2965 The Pilots Brothers' refrigerator-1
查看>>
poj 3026( Borg Maze BFS + Prim)
查看>>
POJ 3041 - 最大二分匹配
查看>>
POJ 3041 Asteroids(二分匹配模板题)
查看>>
Qt笔记——标准文件对话框QFileDialog
查看>>
poj 3083 Children of the Candy Corn
查看>>
POJ 3083 Children of the Candy Corn 解题报告
查看>>
POJ 3253 Fence Repair C++ STL multiset 可解 (同51nod 1117 聪明的木匠)
查看>>
Qt笔记——控件总结
查看>>
poj 3262 Protecting the Flowers 贪心
查看>>
poj 3264(简单线段树)
查看>>
Qt笔记——布局管理三件套分割窗口、停靠窗口和堆栈窗口
查看>>
poj 3277 线段树
查看>>
POJ 3349 Snowflake Snow Snowflakes
查看>>
POJ 3411 DFS
查看>>
poj 3422 Kaka's Matrix Travels (费用流 + 拆点)
查看>>
Qt笔记——官方文档全局定义(二)Functions函数
查看>>
POJ 3468 A Simple Problem with Integers
查看>>