1.shell中数组的定义: 数组名=(value value1 value2 ) 也可以单独的设定数组的分量: arrayL[0]=value arrayL[1]=value1 2.${arrayL[@/*]}获得数组的所有值 3.${#arrayL[@]}获得数组长度 小例子如下: #!/bin/bash arrayList=( ) for i in ${arrayList[@]} do echo ${i} done echo "the length is ${#arrayList[*]}&
目录 Shell 打印文件的最后5行 题解-awk 题解-tail Shell 打印文件的最后5行 经常查看日志的时候,会从文件的末尾往前查看,于是请你写一个 bash脚本以输出一个文本文件 nowcoder.txt中的最后5行 示例: 假设 nowcoder.txt 内容如下: #include<iostream> using namespace std; int main() { int a = 10; int b = 100; cout << "a + b:&quo