C++ rtmp livestream 流媒体

海阔天空 张翼飞翔

我的学习笔记。--我喜欢这里,因为这里安静,无广告骚扰。
随笔 - 82, 文章 - 2, 评论 - 126, 引用 - 0
数据加载中……

常用Shell脚本

判断文件是否存在 
# 注意[ ] 左右二边留空格
if [ -f "./out" ]; then
  echo "rm ./out"
  rm ./out
fi

赋值
# 赋值1 # 注意=左右不能带空格
process="com.tencent.tmgp.sgame"
# 赋值2 命令行返回值
pid1=$(adb shell pidof com.tencent.tmgp.sgame)
# 赋值3 注意点`是键盘左上角哪个,不是单引号'
pid2=`adb shell pidof com.tencent.tmgp.sgame`

for 循环
#!/bin/bash

for((x=0;x<10;x++));do
  echo $x
done

for Row in {1..9};do
  for Column in `seq $Row`;do
    echo -ne "${Column}x${Row}=$[$Row*$Column]\t"
  done
  echo
done        

# sed 
echo 全部字符‘2’替换为字符‘*’
outdir=$(date | sed s/2/*/g)
echo $outdir

echo 全部空格替换为*
outdir=$(date | sed s/[[:space:]]/*/g )
echo $outdir

echo 全部字符‘2’和字符‘0’替换为字符‘*’
outdir=$(date | sed s/[20]/*/g )
echo $outdir

echo 全部字符串“20”替换为字符串“AB”
outdir=$(date | sed s/20/AB/g )
echo $outdir
显示如下:
全部字符‘2’替换为字符‘*’
2021年 06月 23日 星期三 10:14:40 CST
*0*1年 06月 *3日 星期三 10:14:40 CST
全部空格替换为*
2021年 06月 23日 星期三 10:14:40 CST
2021年*06月*23日*星期三*10:14:40*CST
全部字符‘2’和字符‘0’替换为字符‘*’
2021年 06月 23日 星期三 10:14:40 CST
***1年 *6月 *3日 星期三 1*:14:4* CST
全部字符串“20”替换为字符串“AB”
2021年 06月 23日 星期三 10:14:40 CST
AB21年 06月 23日 星期三 10:14:40 CST


# end

posted on 2021-06-15 14:51 ZhangEF 阅读(84) 评论(0)  编辑  收藏 所属分类: Linux