随笔分类 -  shell

shell
摘要:link 参考链接 GNU Bash Reference Manual 文档 https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Redirections 超详细的Shell中特殊字符的用法总结大全 https://www 阅读全文
posted @ 2024-12-26 16:32 ThreeFlower 阅读(68) 评论(0) 推荐(0)
摘要:linux jq 处理字典内的数组 字典 数组 cat data.json { "fruits": ["apple", "banana", "cherry"] } # 获取字典keys jq 'keys' data.json [ "fruits" ] # 获取获取字典中数组keys jq '.fru 阅读全文
posted @ 2024-12-25 16:32 ThreeFlower 阅读(107) 评论(0) 推荐(0)
摘要:ls | xargs -l |awk -F '.' '{printf("%s %s\n",$1,$0)}' |sed 's/^/fastboot flash /g' root@huang:/home/huang/1# ls abl.img cmnlib.img fw_4u1ea.img oem_st 阅读全文
posted @ 2024-12-23 14:52 ThreeFlower 阅读(50) 评论(0) 推荐(0)
摘要:# 文件内容 cat dhcpcode93配置.txt # Type,Architecture Name,Reference # 0x00 0x00,x86 BIOS,[RFC5970][RFC4578] # 0x00 0x01,NEC/PC98 (DEPRECATED),[RFC5970][RFC 阅读全文
posted @ 2024-12-19 18:03 ThreeFlower 阅读(16) 评论(0) 推荐(0)
摘要:#!/bin/bash ### # @Author: huangjinbang # @AuthorEmail: huangjinbang1996@163.com # @Date: 2023-4-12 18:52:45 # @LastEditors: huangjinbang # @LastEdito 阅读全文
posted @ 2024-12-19 17:41 ThreeFlower 阅读(11) 评论(0) 推荐(0)
摘要:在 Shell 脚本中查看当前执行的行号,可以使用 PS4 变量来输出调试信息。以下是一些常用的方法来查看和显示脚本执行的行号: 方法 1:使用 PS4 和 set -x 设置 PS4 变量包含行号信息。 使用 set -x 开启调试模式,执行脚本时会打印出每一行的执行信息。 示例脚本如下: #!/ 阅读全文
posted @ 2024-12-19 17:01 ThreeFlower 阅读(177) 评论(0) 推荐(0)
摘要:sed替换文件夹内所有层级的文件内容 方法一:使用find命令配合sed命令进行替换 find /path/to/directory -type f -exec sed -i 's/old_string/new_string/g' {} + 将/path/to/directory替换为目标文件夹的路 阅读全文
posted @ 2024-12-19 16:54 ThreeFlower 阅读(23) 评论(0) 推荐(0)
摘要:列出文件输出编号; 选择序号,赋予给变量 ls | nl read -p "请输入编号: " num chosen=$(ls | sed -n "${num}p") echo "你选择了: $chosen" cd "$chosen" 2>/dev/null || echo "$chosen 不是一个 阅读全文
posted @ 2024-12-19 16:54 ThreeFlower 阅读(62) 评论(0) 推荐(0)
摘要:#!/bin/bash ### # @Author: huangjinbang # @AuthorEmail: huangjinbang1996@163.com # @Date: 2023-11-12 18:52:45 # @LastEditors: huangjinbang # @LastEdit 阅读全文
posted @ 2024-12-19 16:53 ThreeFlower 阅读(45) 评论(0) 推荐(0)