bash
时光-易逝
Do You Like,Do Yourself!
展开
-
bash-字符串处理
bash中字符串处理:1、利用echo命令进行变量中字符串替换如下:原创 2021-05-22 14:15:14 · 255 阅读 · 0 评论 -
bash-读取文件
如下:-r参数至关重要,当要处理的行含有“/”字符时需要添加,否则“/”会被直接忽略原创 2021-05-22 14:14:42 · 541 阅读 · 0 评论 -
bash-数组
在bash中使用数组,example:数组之间的赋值需要用for循环逐个拷贝#!/bin/bash#declare -i c=$1echo "Start Read_GT_POS ..."a=1c=8fpga_addr0=0xc0400000fpga_addr1=0xc0400008param_n=$#echo input_number:${param_n}echo "note:param1:1~8 represent F1~F8"declare -a my_array_f=(0原创 2021-05-22 14:14:11 · 146 阅读 · 0 评论 -
bash-grep
比较两个文件内容并输出相同或不同部分1,比较输出文件2.txt的独有的部分,区分文件1.txt和2.txt位置(谁在最后一个参数则是输出谁独有部分)grep -Fxvf 1.txt 2.txt2,比较输出文件1.txt和文件2.txt的相同部分,文件1.txt和2.txt位置不区分grep -Fxf 1.txt 2.txt等价于grep -Fxf 2.txt 1.txt示例:#!/bin/bash#!/bin/bashstartTime=`date +%Y%m%d-原创 2021-05-22 13:53:10 · 343 阅读 · 0 评论