Bash编程CV工程师指南
判断操作系统类型
链接:
代码:
进行HTTP 8080 端口抓包
tcpdump -i eth1 -s 0 -l -w - dst port 8080 | strings
# 抓 8080 GET
sudo tcpdump -i eth0 'tcp[(tcp[12]>>2):4] = 0x47455420' |strings
xargs
相关参数
-t
: 执行之前把命令输出到标准错误输出. (方便查看)-I
: 指定占位符号. 如:-I {}
-n1
: 指定每次最大的执行参数个数. 比如这里限定为1个.
ls -1 | xargs -n1 -t -I grep "keywords" {}
单引号包含单引号
使用单引号字符串和双引号字符串交替拼接.
echo 'I'"'"'m a student'
实际上是:
直接转义单引号:
echo 'I\'m a student'
这样是行不通的. 但是下面这样可以:
echo $'I\'m a student'
最简洁的有单引号字符串拼接
这可能是最简洁的写法.
echo 'I'\''m a student'