linux shell 脚本 supress,《linux Shell 脚本攻略》进阶学习(第一部分)

第二章命令之乐

cat 不仅可以读取文件并且连接数据,它还能从标准输入中进行读取

要从标准输入中读取,就要使用管道操作符

echo 'Text through stdin' | cat - file.txt。这里的-被作为来之stdin 文本的文件名称

实例 在file.txt 中写入dfagfmirgjriogjrogijdfgio后

$ echo 'Text through stdin' | cat - file.txt

Text through stdin

dfagfmirgjriogjrogijdfgio

$ echo 'Text through stdin' | cat < file.txt

dfagfmirgjriogjrogijdfgio

$ echo 'Text through stdin' | cat  file.txt

dfagfmirgjriogjrogijdfgio

cat补充内容

-s, --squeeze-blank #压缩连续的空白行

suppress repeated empty output lines

tr

-s, --squeeze-repeats#将多个连续的字符压缩成单个字符

replace each input sequence of a repeated  character  that  is

listed in SET1 with a single occurrence of that character

如:file.txt 内容

line

line

line

line

line

line

line

line

$ cat file.txt | tr -s '\n'

line

line

line

line

line

line

line

line

cat -n stream

-n, --number #给内容之前加上行号

number all output lines

录制与回放终端回话,很实用

开始录制回话

$ script -t 2>time.log -a output.session

Script started, file is output.session

type commend

.....

exit

两个配置文件被同时当做script命令的参数。其中一个文件(timing.log)用于存储时序信息,描述每一个命令在何时运行,另一个文件(output.session)用于存储命令输出,-t选项用于将时序数据导入stderr。2>则用于将stderr重定向到timeing.log。

$ scriptreplay time.log output.session

find文件查找

-print 文件跟文件夹会以\n分隔

find sourcedOf -iname "example" -print(忽略字母大小写)

匹配多个

find \( -name "*".txt -o -name  "*.pdf" \) -print

否定参数!

find . ! -name "*.txt" -print 不以.txt 结尾的

-exec 结合多个命令

-exec ./command.sh {} \;

-exec printf "text file: %s\n" {} \;

$ find . -exec printf "text file is: %s\n" {} \;

text file is: .

text file is: ./file.txt

text file is: ./time.log

text file is: ./output.session

玩转xargs

xargs 也可以将单行或多行文本输入转换成其他格式,例如单行变多行或是多行变单行

bash***都喜欢单行命令

command | xargs

xargs 是一种替换方式,类似与find命令的-exec参数

实战演练

1.将多行输入装换成单行输出

cat file.txt | xargs

line line line line line line line line

2.将单行输入装换成多行输出

指定每行最大值 -n max,每行max个参数,每个参数都是由" " 空格隔开的字符串。空格是默认的定界符

cat file.txt | xargs -n 3

line line line

line line line

line line

更多xargs使用baidu

使用tr进行转换

tr 可以进行替换,删除,压缩

tr 只能通过stdin,而无法通过命令行参数来接受输入。他的调用格式如下

tr [options] set1 set2

echo "Hello who IS ThIs" | tr 'A-M,n-z' 'a-m,N-Z'

hellO WhO iS ThiS

使用tr删除字符

tr -d 'set1' #只使用set1 ,而不使用set2

echo "hello 0980world" | tr -d '0-9'

hello world

字符集的补集

tr -c [set1] [set2]

-c, -C, --complement 补数

use the complement of SET1

zhangjianlin@zhangjianlin:~/mytest/linuxtest/linuxshellscrill/second$ echo -e  "hello 0980world" | tr -d -c '0-9 \n'

0980

zhangjianlin@zhangjianlin:~/mytest/linuxtest/linuxshellscrill/second$ echo -e  "hello 0980world" | tr -d -c '0-9'

算数运算

echo {1..50} | echo $[ $( tr ' ' '+' ) 0 ]

1725

$[ operation ] 执行算术运算

相当于$[ 1+...+50+0 ]

文件名的处理

$name ${name%$1}$2  #${name%\.*} "%"号除去后缀名,只取文件名

${file_name#*.} 只留扩展名或后缀

校验和核实

校验对与编写备份脚本或系统维护脚本来说都非常重要

最知名且最为广泛的校验和技术是md5sum和shalsum

实战演练

计算md5sum,使用下面命令

md5sum filename

$ md5sum file.txt

221950d53cb7cc10da1c3e7e7ec4e0d5  file.txt

$ md5sum file.txt > file.md5

$ md5sum -c file.md5

file.txt: 确定

sha1sum 跟 md5sum类似

对目录进行校验

校验和是从文件中计算得来的。对目录计算校验和意味着我们需要对目录中的所有文件以递归的方式进行计算

它可以使用命令md5deep或sha1deep来实现

md5deep -rl directory_path >directory.md5

#-r 使用递归的方式

#-l 使用相对路径。默认md5会输出文件的绝对路径

用下面命令进行核实

$ md5sum -c directory.md5

批量重命名和移动批量重命名文件名称(包括后缀名)#a!/bin/bash

functionlistfiles(){

forfilein*; # * is all of pwd'files

do

echo$file

done

}

functioninputRule(){

read-p "please input the fromsuffix as *.txt:"fromsuffix;

read-p "please input the tosuffix as .txt:"tosuffix;

read-p "please input the part of file name:"headname;

}

functionchangename(){

count=1;

forfromname in$fromsuffix;

do

new="${headname}${count}${tosuffix}"

mv"$fromname""$new"2> /dev/null;

if[ $? -eq0 ];

then

echo"Renameing $fromname to $new";

letcount++

fi

done

}

inputRule;

changename;

#listfiles;

批量更改名称后缀,不包含名称#!/bin/bash

functioninputDialog(){

read-p "input fromsuffix:"fromsuffix

read-p "input tosuffix:"tosuffix

}

functionchangeSuffix(){

forfromname in*${fromsuffix};

do

#echo $fromname \n

#echo ${fromname%$fromsuffix}$tosuffix

mv"$fromname""${fromname%$fromsuffix}$tosuffix"#不加""mv: 目标"*.png" 不是目录

if[ $? -eq0 ];

then

echo"$fromname"rename to "${fromname%$fromsuffix}$tosuffix"

fi

done

}

inputDialog;

changeSuffix;

echo -e "\e[1;42m Green Background \e[0m"  彩色背景打印

echo $var 或 echo ${var}var=value 一个赋值

var = value 一个相等操作

赋值时双引号的使用(value是否包含空格)

若无空格,特殊字符,加不加无所谓

如:var=value 或 var="value"

但var="value cat" 必须加""

length=${#var}获取变量值的长度

如:

zhangjianlin@zhangjianlin:~$ echo ${#PATH}

288

算数运算

zhangjianlin@zhangjianlin:~/mytest/linuxtest/linuxshell$echo "4 * 0.56" | bc

2.24

数组

array_var=(1212 1233 424 565)

#!/bin/bash

array_var=(1212 3434 546 7687)

echo ${array_var[*]} {}命令块,能执行命令,处理特殊字符

echo ${#array_var[*]} #4#!/bin/bash

array_var=(1212 3434 546 7687)

echo ${array_var[*]}

echo ${#array_var[*]}

alias rmback='cp $@ ~/backup; rm $@' 删除时备份

终端工具

tput和stty是两款终端处理工具

tput cols,lines,longname,cpu 100 100,

输入密码时,不能让输入的内容显示出来。用stty#!/bin/bash

#Filename:password.sh

function enterpassword(){

echo -e "Enter password"

stty -echo

read password

stty echo

echo password read

}

enterpassword

在脚本中生成延时#!/bin/bash

#Filename: sleep.sh

function delaytime(){

echo -n Count:

tput sc #store cursor

count=0;

while true;

do

if [ $count -lt 40 ];

then let count++;

sleep 1;

tput rc #recover cursor

tput ed #clear the content from the head to tail of cursor

echo -n $count;

else exit 0;

fi

done

}

delaytime;

递归函数

bash同样支持递归函数

F(){echo $1;F hello;sleep 1;}

Fork×××":(){ :|:& };:"这个递归能调用自身,不断产生新的进程 :勿用

利用子shell 生成一个独立进程

#!/bin/bash

pwd

(cd /bin; ls);

pwd

通过引用子shell的方式保留空格和换行符

假设我们使用子shell或反引号的方法将命令的输出读入一个变量中,可以将它放入双引号中,以保留空格和换行符(\n)

out="$(cat text.txt)" 保留空格跟换行符号

out=$(cat text.txt)

用不回显的方式读取密码read

read -s var

在特定时限内读取输入

read -t 2 var

read -t 2 -s var

使用定界符结束输入,不使用Enter结束输入

read -d ":" var  达到能输入换行的母的

zhangjianlin@zhangjianlin:~/mytest/linuxtest/linuxshellscrill/first$ read -d ":" var

dfdufdif

fdfidjf

gfgig

:

考虑CSV的数据情况#!/bin/bash

function changeIFS(){

oldIFS=$IFS #IFS的默认值是空白字符(换行符,制表符或者空格)

IFS=,

for item in $data;

do

echo item: $item

done

IFS=$oldIFS

}

data="name,sex,rollno,location" #使用IFS读取变量的每一个条目

changeIFS;

#IFS默认空格,这里把他变成","

输出结果

item: name

item: sex

item: rollno

item: location

实战演练#!/bash/bin

#user of shell

function usesh(){

oldIFS=$IFS;

IFS=":";

count=0;

for item in $line;

do

[ $count -eq 0 ] && user=$item;

[ $count -eq 6 ] && shell=$item;

let count++;

done

IFS=$oldIFS

}

line="root:x:0:0:root:root:/bin/bash"

usesh;

echo $user\'s shell is $shell

for循环

for var in list

do

conmend

done

echo {1..30};echo {a..z};echo {A..Z};echo {a..h};

for i in {a..z};

do

commend

done

for((i=0;i<10;i++))

{

commend

}

比较与测试

逻辑运算将它变得简洁

[ condition ] && action; 如果是真执行action

[ condition ] || action; 如果是假真执行action

算术比较(数字比较)

[ $var -eq 0 ] or [ $var -ne 0 ]

其他的操作符

-gt 大于

-lt 小于

-ge 大于或等于

le 小于或等于

-eq 等于

文件相关的测试

[ -f $file_var ] 是否是文件

-x 可执行

-d 目录

-e存在

-c 字符设备路径

-b 块设备

-w 文件可写

-r 文件是否可读

-L 符号连接

判断输入的是否为文件或文件夹

#!/bin/bash

functionfileordir(){

if[ -e $fpath ];then# exist

if[ -d $fpath ] ;then#directory

echo$fpath is a dir;

exit

fi

if[ -f $fpath ] ;then

echo$fpath is a file;

exit

fi

elseecho-e "$fpath not exit";exit;

fi

echo"unknow file type"

}

fpath=$1

fileordir;

zhangjianlin@zhangjianlin:~/mytest/linuxtest/linuxshellscrill/first$ bash filetest.sh .

字符串比较

使用字符串比较时,最好用双括号,因为有时候采用单引号会产生错误,所以最好避开他们。

[[ $str1 == $str2 ]]

[[ $str1 != $str2 ]]

[[ $str1 > $str2 ]]

[[ $str1 < $str2 ]]

[[ $str1 -z $str2 ]] 空字窜

[[ $str1 -n $str2 ]] 非空字窜

if [[ $str1 < $str2 ]] && [[ $str1 == $str2 ]]

test命令执行条件检测

test有助于避免使用过多的括号

之前的[]测试条件同样可以用于test命令

if [ $var -eq 0 ];then echo "True";fi

if test $var -eq 0 ;then echo "True";fi

第二章命令之乐

cat 不仅可以读取文件并且连接数据,它还能从标准输入中进行读取

要从标准输入中读取,就要使用管道操作符

echo 'Text through stdin' | cat - file.txt。这里的-被作为来之stdin 文本的文件名称

实例 在file.txt 中写入dfagfmirgjriogjrogijdfgio后

$ echo 'Text through stdin' | cat - file.txt

Text through stdin

dfagfmirgjriogjrogijdfgio

$ echo 'Text through stdin' | cat < file.txt

dfagfmirgjriogjrogijdfgio

$ echo 'Text through stdin' | cat  file.txt

dfagfmirgjriogjrogijdfgio

cat补充内容

-s, --squeeze-blank #压缩连续的空白行

suppress repeated empty output lines

tr

-s, --squeeze-repeats#将多个连续的字符压缩成单个字符

replace each input sequence of a repeated  character  that  is

listed in SET1 with a single occurrence of that character

如:file.txt 内容

line

line

line

line

line

line

line

line

$ cat file.txt | tr -s '\n'

line

line

line

line

line

line

line

line

cat -n stream

-n, --number #给内容之前加上行号

number all output lines

录制与回放终端回话,很实用

开始录制回话

$ script -t 2>time.log -a output.session

Script started, file is output.session

type commend

.....

exit

两个配置文件被同时当做script命令的参数。其中一个文件(timing.log)用于存储时序信息,描述每一个命令在何时运行,另一个文件(output.session)用于存储命令输出,-t选项用于将时序数据导入stderr。2>则用于将stderr重定向到timeing.log。

$ scriptreplay time.log output.session

find文件查找

-print 文件跟文件夹会以\n分隔

find sourcedOf -iname "example" -print(忽略字母大小写)

匹配多个

find \( -name "*".txt -o -name  "*.pdf" \) -print

否定参数!

find . ! -name "*.txt" -print 不以.txt 结尾的

-exec 结合多个命令

-exec ./command.sh {} \;

-exec printf "text file: %s\n" {} \;

$ find . -exec printf "text file is: %s\n" {} \;

text file is: .

text file is: ./file.txt

text file is: ./time.log

text file is: ./output.session

玩转xargs

xargs 也可以将单行或多行文本输入转换成其他格式,例如单行变多行或是多行变单行

bash***都喜欢单行命令

command | xargs

xargs 是一种替换方式,类似与find命令的-exec参数

实战演练

1.将多行输入装换成单行输出

cat file.txt | xargs

line line line line line line line line

2.将单行输入装换成多行输出

指定每行最大值 -n max,每行max个参数,每个参数都是由" " 空格隔开的字符串。空格是默认的定界符

cat file.txt | xargs -n 3

line line line

line line line

line line

更多xargs使用baidu

使用tr进行转换

tr 可以进行替换,删除,压缩

tr 只能通过stdin,而无法通过命令行参数来接受输入。他的调用格式如下

tr [options] set1 set2

echo "Hello who IS ThIs" | tr 'A-M,n-z' 'a-m,N-Z'

hellO WhO iS ThiS

使用tr删除字符

tr -d 'set1' #只使用set1 ,而不使用set2

echo "hello 0980world" | tr -d '0-9'

hello world

字符集的补集

tr -c [set1] [set2]

-c, -C, --complement 补数

use the complement of SET1

zhangjianlin@zhangjianlin:~/mytest/linuxtest/linuxshellscrill/second$ echo -e  "hello 0980world" | tr -d -c '0-9 \n'

0980

zhangjianlin@zhangjianlin:~/mytest/linuxtest/linuxshellscrill/second$ echo -e  "hello 0980world" | tr -d -c '0-9'

算数运算

echo {1..50} | echo $[ $( tr ' ' '+' ) 0 ]

1725

$[ operation ] 执行算术运算

相当于$[ 1+...+50+0 ]

文件名的处理

$name ${name%$1}$2  #${name%\.*} "%"号除去后缀名,只取文件名

${file_name#*.} 只留扩展名或后缀

校验和核实

校验对与编写备份脚本或系统维护脚本来说都非常重要

最知名且最为广泛的校验和技术是md5sum和shalsum

实战演练

计算md5sum,使用下面命令

md5sum filename

$ md5sum file.txt

221950d53cb7cc10da1c3e7e7ec4e0d5  file.txt

$ md5sum file.txt > file.md5

$ md5sum -c file.md5

file.txt: 确定

sha1sum 跟 md5sum类似

对目录进行校验

校验和是从文件中计算得来的。对目录计算校验和意味着我们需要对目录中的所有文件以递归的方式进行计算

它可以使用命令md5deep或sha1deep来实现

md5deep -rl directory_path >directory.md5

#-r 使用递归的方式

#-l 使用相对路径。默认md5会输出文件的绝对路径

用下面命令进行核实

$ md5sum -c directory.md5

批量重命名和移动批量重命名文件名称(包括后缀名)#a!/bin/bash

functionlistfiles(){

forfilein*; # * is all of pwd'files

do

echo$file

done

}

functioninputRule(){

read-p "please input the fromsuffix as *.txt:"fromsuffix;

read-p "please input the tosuffix as .txt:"tosuffix;

read-p "please input the part of file name:"headname;

}

functionchangename(){

count=1;

forfromname in$fromsuffix;

do

new="${headname}${count}${tosuffix}"

mv"$fromname""$new"2> /dev/null;

if[ $? -eq0 ];

then

echo"Renameing $fromname to $new";

letcount++

fi

done

}

inputRule;

changename;

#listfiles;

批量更改名称后缀,不包含名称#!/bin/bash

functioninputDialog(){

read-p "input fromsuffix:"fromsuffix

read-p "input tosuffix:"tosuffix

}

functionchangeSuffix(){

forfromname in*${fromsuffix};

do

#echo $fromname \n

#echo ${fromname%$fromsuffix}$tosuffix

mv"$fromname""${fromname%$fromsuffix}$tosuffix"#不加""mv: 目标"*.png" 不是目录

if[ $? -eq0 ];

then

echo"$fromname"rename to "${fromname%$fromsuffix}$tosuffix"

fi

done

}

inputDialog;

changeSuffix;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/349916.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

xaml_XAML或JavaFx?

xaml这是使用XAML和JavaFx构建应用程序的快速&#xff0c;主观&#xff0c; 无权且非常不科学的比较。 比较是基于我与每个人合作的个人经验。 在XAML方面&#xff0c;这意味着WPF和Win8存储应用程序 。 在JavaFx方面&#xff0c;这意味着Windows 7应用程序。 JavaFX JavaFx被…

古代猪文

题意&#xff1a; 给定q &#xff0c;n 求$q^{\sum\limits {d|n} C_{n}^{d} }mod 999911659$ 题解&#xff1a; 首先如果你直接算次方上的数的话会炸掉&#xff0c;因为欧拉定理我们可以得到 $q^{\sum\limits {d|n} C_{n}^{d} mod999911658}mod 999911659$ 因为mod的数是个合数…

linux gcc 7.3.0安装,升级gcc到7.3.0

#查看当前版本gcc --version # 先查看当前版本确认是否需要升级tar -zxvf gcc-7.3.0.tar.gzcd gcc-7.3.0#检测和安装相关依赖包&#xff0c;这个过程需要耐心等待&#xff0c;此步骤会将依赖包下载到gcc-7.3.0目录&#xff0c;如果因网络原因无法完成请自行使用wget下载。该步骤…

使用Envoy代理的微服务模式,第二部分:超时和重试

该博客是系列文章的一部分&#xff0c;该系列文章更深入地介绍了Envoy Proxy和Istio.io &#xff0c;以及它如何实现更优雅的连接和管理微服务的方式。 跟随我christianposta &#xff0c;紧跟这些博客文章的发布。 什么是Envoy代理 &#xff0c;它如何工作&#xff1f; 如何…

矩阵快速幂总结

依然主要还是自用 首先矩阵一条性质的概述和证明 概述:对于一个临接矩阵$G$来说&#xff0c;它自乘$G^k$次方中$G[i][j]$含义为从i走到j走k步方案数. 证明:比较麻烦,我们设f[i]表示从1走到其他点方案数,那么根据矩阵递推优化,k次就是转移了k次,那么每次走一步,k次就是走了k步 最…

c语言有一个正整数加上100,c语言编程实现:一个整数,它加上100后是完全平方数,再加168又是完全平方数,求该数。...

满意答案问题&#xff1a;一整数&#xff0c;它加100后是完全平方数&#xff0c;再加168还是完全平方数&#xff0c;求该整数解题思路&#xff1a;设该数为x&#xff0c;它加100后是A&#xff0c;再加168为B。则因为A是完全平方数&#xff0c;所以A为正数&#xff0c;且Ay*y&am…

C语言计算分段函数pta,PTA浙大版《C语言程序设计(第3版)》题目集 练习2-11 计算分段函数[2] (10分)...

1.编程将一个字符串中所有空格替换为“%20”#define _CRT_SECURE_NO_WARNINGS#include #includeusing namespace std;const int maxd 20;//最大深度int m[1 << maxd];//最大结点个数为2的maxd次方-1//编程将字符串中的空格用%20代替…2021/5/21 3:32:25pssh是由python编写…

「PKUWC2018」Slay the Spire

国际惯例不放题干 扯淡 其实题目翻译过来是杀戮尖塔&#xff0c;某steam上的卡牌游戏&#xff0c;我也曾热衷刷榜 题解 首先题目中要求的期望是假期望,结合题目中所给的阶乘就可以看出这其实是从$2*n$张牌中选择$m$张牌使用,并且所有情况都取最大值时的和 首先排序贪心最大 再说…

java lambda使用_在Java 8 Lambda上使用Apache Commons Functor功能接口

java lambda使用Apache Commons Functor &#xff08;以下称为[functor]&#xff09;是一个Apache Commons组件&#xff0c;它提供功能性的编程API和已实现的几种模式&#xff08;访问者&#xff0c;生成器&#xff0c;聚合器等&#xff09;。 Java 8具有几个不错的新功能&…

基于svm图像分类C语言,基于SVM的图像分类算法与实现.PDF

, ( ) 计算机工程与应用40 ComputerEngineeringandApplications基于SVM的图像分类算法与实现张淑雅 赵一鸣 李均利, ,, ,ZHANGShu-yaZHAOYi-mingLIJun-li宁波大学 数字技术与应用软件研究所 浙江 宁波, 315211, , , ,InstituteofDSPandSoftwareTechniquesNingboUniversityNingb…

前端ui框架

http://frozenui.github.io/components.html#progress rozenUI是什么 Frozen UI是一个开源的简单易用&#xff0c;轻量快捷的移动端UI框架。基于手Q样式规范&#xff0c;选取最常用的组件&#xff0c; 做成手Q公用离线包减少请求&#xff0c;升级方式友好&#xff0c;文档完善…

德国留学语言c1,德国留学申请,关于语言

申请德国大学并不容易&#xff0c;语言是一大关。对于申请德国大学的人来说&#xff0c;除国际课程和个别专业外&#xff0c;各大学对申请人德语学时要求一般都在800学时以上&#xff0c;目前比较权威的德语考试有TestDaf和DSH这两种类型。TestDaF&#xff1a;“外国学生申请大…

一个iOS表单框架-UFKit

效果&#xff1a; 使用&#xff1a; pod UFKit- (void)viewDidLoad {[super viewDidLoad];__block UFFormView *formView [UFFormView makeFormView:^(UFFormViewMaker * _Nonnull make) {make.addSection([UFSection makeSection:^(UFSectionMaker * _Nonnull make) {make.ad…

c语言手写指针和乘号,C-学会使用指针(示例代码)

先说&#xff1a;唯手熟尔指针指针存储着一个内存空间的地址定义一个指针int a&#xff1b;int * p&#xff1b;定义一个指针&#xff0c;只需在变量前面加一个 * 号。这里的指针只能存储一个存放整数的内存空间的地址指针如何存储地址p &a;&叫取地址符。这样整形指针…

考后反思7.25

D1 考试时首先看的第一题&#xff0c;不会&#xff0c;然后看第二题&#xff0c;原题&#xff01;&#xff01;&#xff01;&#xff01; 第二题啥也没想&#xff0c;就只是打了一个tarjan判割点&#xff0c; 打完的时候有点慌&#xff0c;总觉得自己打错了什么&#xff0c;调了…

android getinstance 方法,Android中的'new Fragment()'和'Fragment.getInstance()'有什么区别?...

当我们片段添加到特定的布局&#xff0c;我们可以使用folloing码Fragment fragment new SampleFragment();FragmentManager fragmentManager getSupportFragmentManager();FragmentTransaction fragmentTransaction fragmentManager.beginTransaction();fragmentTransaction…

查找发布地图的 REST URL并查询相关信息

1、登录ArcGIS Server Manager 2、登录后&#xff0c;里面是以前自己发布的地图服务 3、点击自己发布的地图&#xff0c;然后按下功能选项&#xff0c;再点击箭头来找到URL 4、点击进去&#xff0c;分别能从红圈中找到相关的信息&#xff0c;分别为arcgis JavaScript&#xff0…

maven使用testng_使用Maven Failsafe和TestNG分别运行单元测试和集成测试

maven使用testng最近&#xff0c;对于我的新宠物项目&#xff0c;我决定我希望在标准mvn测试期间执行一些测试&#xff0c;而仅在不同阶段执行一些其他测试 &#xff0c;我们称其为集成阶段。 我在谷歌上搜索&#xff0c;似乎没有任何工作&#xff0c;因此在努力使安装工作顺利…

android webview 重定向 goback,Android WebView 网址重定向影响 goBack

我们在使用 Android 自带的控件 WebView 访问某网址的时候, 网址会通过某些方式进行重定向. 这时会出现一个问题.我们在使用 Android 自带的控件 WebView 访问某网址的时候, 网址会通过某些方式进行重定向. 这时会出现一个问题.如下所示:你想要在 『A网址』 中打开 『C网址』, …

android 仿qq it蓝豹,《IT蓝豹》listview实现各种版面设计功能

本项目主要listview实现各种版面设计功能&#xff0c;有实现列表的&#xff0c;gridview效果的&#xff0c;有混排效果的等等。自定义TwoWayView继承RecyclerView&#xff0c;通过TwoWayView去根据布局实现到底选择哪一个效果&#xff0c;本项目来自&#xff1a;https://github…