shell脚本开发基础

news2024/7/6 19:13:16

shell脚本开发基础

什么是linux内置命令?什么是外置命令

内置命令:在系统启动时就加载入内存,常驻内存,执行效率更高,但是占用资源,cd

外置命令:系统需要从硬盘中读取程序文件,再读入内存加载

外置命令,也称之为,自已单独下载的文件系统命令,处于bash shell之外的程序

/bin
/usr/bin
/sbin
/usr/sbin

[root@linux home]# which cd
/usr/bin/cd
[root@linux home]#

通过1inux的type命令,验证是否是内置、外置命令

比如ps命令

[root@linux home]# type ps
ps is hashed (/usr/bin/ps)
[root@linux home]# type cd
cd is a shell builtin
[root@linux home]#

外置命令的特点是:一定会开启子进程执行

[root@linux home]# ps -ef --forest
root      8541  1083  0 17:16 ?        00:00:00  \_ sshd: root@pts/1
root      8548  8541  0 17:17 pts/1    00:00:00  |   \_ -bash
root      8615  8548  0 18:09 pts/1    00:00:00  |       \_ ps -ef --forest

子shell和父shell

为什么要学习子shell

she11的进程列表理念,需要使用()小括号,如下执行方式,就称之为,进程列表

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

  1. source和.,执行脚本,只在当前的shel1环境中执行生效

  2. 指定bashsh解释器运行脚本,是开启subshell,开启子shel1运行脚本命令

  3. ./script,都会指定shebang,通过解释器运行,也是开启subshell运行命令

环境变量

环境变量一般指的是用export内置命令导出的变量,用于定义shell的运行环境、保证shell命令的正确执行。
shell通过环境变量确定登录的用户名、PATH路径、文件系统等各种应用。
环境变量可以在命令行中临时创建,但是用户退出shell终端,变量即丢失,如要永久生效,需要修改 环境变
量配置文件

  • 用户个人配置文件/.bash_profile、/.bashrc 远程登录用户特有文件
  • 全局配置文件/etc/profile、/etc/bashrc,且系统建议最好创建在/etc/profile.d/,而非直接修改主文件,修改全局配置文件,影响所有登录系统的用户

检查系统环境变量的命令

  • set,输出所有变量,包括全局变量、局部变量
  • env,只显示全局变量
  • declare,输出所有的变量,如同set
  • export,显示和设置环境变量值

撤销环境变量

  • unset变量名,删除变量或函数。

设置只读变量

  • readonly,只有shell结束,只读变量失效

环境变量文件的加载顺序

在这里插入图片描述

特殊状态变量

shell的特殊变量,用在如脚本,函数传递参数使用,有如下特殊的,位置参数变量

$0 获取she11脚本文件名,以及脚本路径

$n 获取she11脚本的第n个参数,n在1~9之间,如$1,$2, 9 ,大于 9 则需要写, 9,大于9则需要写, 9,大于9则需要写,{10},参数空格隔开

$# 获取执行的she11脚本后面的参数总个数

∗ 获取 s h e l 1 脚本所有参数,不加引号等同于 * 获取shel1脚本所有参数,不加引号等同于 获取shel1脚本所有参数,不加引号等同于@作用,加上引号“$*“作用是接收所有参数为单个字符串,“$1$2…

$@ 不加引号,效果同上,加引号,是接收所有参数为独立字符串,如"$1"“$2"

[root@linux home]# cat ppp.sh
#filename:ppp.sh
#author:ysy
#created time:2024-05-26

#!/bin/bash

echo '################'
echo '$0实战'

echo ‘结果:’ $0

echo '################'
echo '$1实战'

echo ‘结果:’ $1

echo '################'
echo '$2实战'

echo ‘结果:’ $2

echo '################'
echo '$#实战'

echo ‘结果:’ $#

echo '################'
echo '$*实战'

echo ‘结果:’ $*

echo '################'

echo '$@实战'
echo ‘结果:’ $@
[root@linux home]#
[root@linux home]#
[root@linux home]# bash ppp.sh name 111 222 333 444
################
$0实战
‘结果:’ ppp.sh
################
$1实战
‘结果:’ name
################
$2实战
‘结果:’ 111
################
$#实战
‘结果:’ 5
################
$*实战
‘结果:’ name 111 222 333 444
################
$@实战
‘结果:’ name 111 222 333 444
[root@linux home]#

总结提高
$*和$的区别你了解吗?

$*$@都表示传递给函数或脚本的所有参数

当 $*$@不被双引号”“包围时,它们之间没有任何区别,都是将接收到的每个参数看做一份数据,彼此之间以空格来分隔。

但是当它们被双引号”“包含时,就会有区别了:
“$*“会将所有的参数从整体上看做一份数据,而不是把每个参数都看做一份数据。
"name 111 222 333 444"

"$@“仍然将每个参数都看作一份数据,彼此之间是独立的。
"name"
"111"
"222"
"333"
"444"

比如传递了 5 个参数,那么对于“$*“来说,这 5 个参数会合并到一起形成一份数据,它们之间是无法分割的;而对于“$@“来说,这 5 个参数是相互独立的,它们是 5 份数据。

如果使用 echo 直接输出“$*"和"$@“做对比,是看不出区别的;但如果使用 for 循环来逐个输出数据,立即就能看出区别来。
  • $? 上一次命令执行状态返回值,0正确,非失败
  • $$ 当前shel1脚本的进程号
  • $! 上一次后台进程的PID
  • $_ 获取上次执行的命令的最后一个参数
  • 查找方式 man bash -> 搜索Special Parameters
[root@linux home]# cat ttt.sh
#!/bin/bash
# $#获取参数个数
[ $# -ne 2 ] && {
        echo "must be two args"
        exit 119 #终止程序运行,且返回119状态码,提供给当前shel1的$?变量,若是在函数里 可以return 119用法
}
echo "没毛病,就是2个参数"
[root@linux home]#

[root@linux home]# bash ttt.sh
 must be two args
[root@linux home]# bash ttt.sh name 111 222
 must be two args
[root@linux home]# echo $?
119
[root@linux home]# bash ttt.sh name 111
没毛病,就是2个参数
[root@linux home]# echo $?
0
[root@linux home]#

$!

获取上一次后台执行的程序的PID

[root@linux home]# nohup ping www.baidu.com & 1> /dev/null
[1] 8781
[root@linux home]# nohup: ignoring input and appending output to ‘nohup.out’

[root@linux home]# ps -elf | grep ping
4 S root      8781  8694  0  80   0 - 37523 poll_s 20:23 pts/0    00:00:00 ping www.baidu.com
0 R root      8783  8694  0  80   0 - 28203 -      20:24 pts/0    00:00:00 grep --color=auto ping
[root@linux home]# echo $!
8781
[root@linux home]#

$$

获取当前shell脚本的进程ID

[root@linux home]# cat ttt.sh
#!/bin/bash
# $#获取参数个数
[ $# -ne 2 ] && {
        echo " must be two args "
        exit 119 #终止程序运行,且返回119状态码,提供给当前shel1的$?变量,若是在函数里 可以return 119用法
}
echo "没毛病,就是2个参数"
echo "当前脚本的PID:$$"
[root@linux home]#

[root@linux home]# bash ttt.sh name 111
没毛病,就是2个参数
当前脚本的PID:8790
[root@linux home]#

$_

获取上次执行的命令的最后一个参数

[root@linux home]# bash ttt.sh name 111
没毛病,就是2个参数
当前脚本的PID:8790
[root@linux home]# echo $_
111
[root@linux home]#

bash的一些基础内置命令

  • echo 输出变量内容
  • eval 执行多个命令
  • exec 不创建子进程执行后续命令,且执行完毕后,自动exit
  • export
  • read
  • shift

echo 命令输出变量内容

-n 不换行输出
-e解析字符串中的特殊符号
\n 换行
\r回车
\t 制表符 四个空格
\b 退格
[root@linux shell_program]#
[root@linux shell_program]# echo 你真胖;echo你还挺可爱
你真胖
你还挺可爱
不换行打印
[root@linux shell_program]# echo -n 你真胖;echo你还挺可爱
你真胖你还挺可爱
[root@chaogelinux shell_program]# echo -n 你真胖;echo -n 你还挺可爱
你真胖你还挺可爱[root@chaogelinux shell_program]#

[root@chaogelinux shell_program]# echo -e "我看你挺\n好的"
我看你挺
好的

eval

执行多个命令

[root@linux home~]# eval cd /root;ls
anaconda-ks.cfg  cmatrix  Term-Animation-2.4  Term-Animation-2.4.tar.gz
[root@linux ~]#

exec

不创建子进程执行后续命令,且执行完毕后,自动exit

[root@linux ~]# ps -ef --forest
root      8688  1083  0 19:41 ?        00:00:00  \_ sshd: root@pts/0
root      8694  8688  0 19:42 pts/0    00:00:00  |   \_ -bash
root      8720  8694  0 19:42 pts/0    00:00:00  |       \_ bash
root      8731  8720  0 19:42 pts/0    00:00:00  |           \_ ps -ef --forest

[root@linux ~]# exec date
Sun May 26 19:43:07 CST 2024
[root@linux ~]#
[root@linux ~]# ps -ef --forest
root      8688  1083  0 19:41 ?        00:00:00  \_ sshd: root@pts/0
root      8694  8688  0 19:42 pts/0    00:00:00  |   \_ -bash
root      8732  8694  0 19:43 pts/0    00:00:00  |       \_ ps -ef --forest

字符串截取

# 从开头删除匹配最短
## 从开头删除匹配最长
% 从结尾削除匹配最短
%% 从结尾删除匹配最长

#指定字符内容截取
a*c                     匹配开头为a,中间任意个字符,结尾为c的字符串
a*c 					匹配开头为a,中间任意个字符,结尾为C的字符串

#语法
name“yuchao”  			# 该变量的值,有索引,分别是从e,1,2,3,4开始
$(变量)            	  返回变量值
$(#name)				返回变量长度,字符长度-
$(变量:start)			  返回变量start数值之后的学符,且包含start的数字
$(变量:start:length)	 提取start之后的length限制的字符,例如$(name:4:1)
$(变量#word)			  从变量开头删除最短匹配的word子串$(name:ysy)
$(变量##word)			  从变量开头,删除最长匹配的word
$(变量%word)			   从变量结尾刷除最短的word
$(变量%%word)	          从变量结尾开始制除最长匹配的word

替换
$(变量/pattern/string)	用string代替第一个配的pattern
$(变量//pattern/string)	用string代替所有的pattern
实战:批量修改所有文件名

现有9个txt文件,需要将文件名称中的test删除

[root@linux test]# touch name-{1..9}-test.txt
[root@linux test]# ll
total 0
-rw-r--r--. 1 root root 0 May 26 18:42 name-1-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-2-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-3-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-4-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-5-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-6-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-7-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-8-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-9-test.txt
[root@linux test]#
思路:
1.单个文件怎么去除? 使用mv命令直接修改

[root@linux test]# mv name-1-test.txt name-1.txt
[root@linux test]# ll
total 0
-rw-r--r--. 1 root root 0 May 26 18:42 name-1.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-2-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-3-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-4-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-5-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-6-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-7-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-8-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-9-test.txt
[root@linux test]#


2.利用变量的子串功能,去掉字符信息

[root@linux test]# filename=name-2-test.txt
[root@linux test]# echo $filename
name-2-test.txt
[root@linux test]# echo ${filename}
name-2-test.txt
[root@linux test]# echo ${filename//-test/}
name-2.txt          #可以得到最中的文件名,然后配合mv命令进行修改,如第3步
[root@linux test]#

3.利用反引号功能,修改单个文件名
[root@linux test]# echo ${filename//-test/}
name-2.txt
[root@linux test]# mv ${filename} `echo ${filename//-test/}`
[root@linux test]# ll
total 0
-rw-r--r--. 1 root root 0 May 26 18:42 name-1.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-2.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-3-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-4-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-5-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-6-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-7-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-8-test.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-9-test.txt
[root@linux test]#


4.使用循环批量修改

[root@linux test]# #设置循环变量
[root@linux test]# ls *-test.txt
name-3-test.txt  name-4-test.txt  name-5-test.txt  name-6-test.txt  name-7-test.txt  name-8-test.txt  name-9-test.txt
[root@linux test]# echo `ls *-test.txt`
name-3-test.txt name-4-test.txt name-5-test.txt name-6-test.txt name-7-test.txt name-8-test.txt name-9-test.txt
[root@linux test]# for filename in  `ls *-test.txt` ;do echo $filename;done
name-3-test.txt
name-4-test.txt
name-5-test.txt
name-6-test.txt
name-7-test.txt
name-8-test.txt
name-9-test.txt
[root@linux test]# for filename in  `ls *-test.txt` ;do mv $filename `echo ${filename//-test/}`;done
[root@linux test]# ll
total 0
-rw-r--r--. 1 root root 0 May 26 18:42 name-1.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-2.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-3.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-4.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-5.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-6.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-7.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-8.txt
-rw-r--r--. 1 root root 0 May 26 18:42 name-9.txt
[root@linux test]#


特殊shell扩展变量

这四个扩展变量,都是对变量的值进行判断、处理

:-
如果parameter变量值为空,返回word字符串,赋值给result变量
result=$(parameter:-word)

:=
如果para变量为空,则word替代变量值,且返回其值
$(parameter:=word)

:?
如果para变量为空,word当作stderr输出,否则输出变量值
用于设置变量为空导致错误时,返回的错误信息
$(parameter:?word

:+
如果para变量为空,什么都不做,否则word返回
$(parameter:+word)

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

:-

  • 判断变量值是否为空,如果为空就返回后面的字符信息
  • 如果不为空,就返回本身
#name为空
[root@linux test]# echo $name

[root@linux test]# result=${name:-hello}
[root@linux test]# echo $name

[root@linux test]# echo $result
hello
[root@linux test]#

#name不为空
[root@linux test]# result=${name:-hello}
[root@linux test]#
[root@linux test]# echo $name
123
[root@linux test]# echo $result
123
[root@linux test]#

:=

  • 判断变量值是否为空,如果为空就返回后面的字符信息,同时将后边的信息赋给变量本身
  • 如果不为空,就返回变量内容
#name为空
[root@linux test]# echo $name $result

[root@linux test]# result=${name:=hahahahha}
[root@linux test]# echo $result
hahahahha
[root@linux test]# echo $name
hahahahha
[root@linux test]#

#name不为空
[root@linux test]# name="150"
[root@linux test]# result=${name:=hahahahha}
[root@linux test]#
[root@linux test]# echo $result
150
[root@linux test]# echo $name
150
[root@linux test]#

:?

  • 当变量值为空,出动抛出错误信息
  • 不为空,返回变量的信息
[root@linux test]# echo ${nname}

[root@linux test]# echo ${nname:?变量为空}
-bash: nname: 变量为空
[root@linux test]# nname="yyyyy"
[root@linux test]# echo ${nname:?变量为空}
yyyyy
[root@linux test]#

:+

  • 当变量为空,什么都不做
  • 不为空,返回后面的信息
[root@linux test]# echo $tom

[root@linux test]# echo ${tom:+6666}

[root@linux test]# tom="abc"
[root@linux test]# echo $tom
abc
[root@linux test]# echo ${tom:+6666}
6666
[root@linux test]#

实战:删除过期的数据备份文件脚本

删除7天以上的过期数据

find xargs搜索,且删除

#删除7天以上的过期数据
find需要搜索的目录 -name 你要搜索的文件名字 -type文件类型 -mtime +7| xargs rm -f


cat del data.sh
#shel1语法是否有bug
#希望删除某个数据文件夹的备份文件
#dir_path="/data/mysql_back_data/"

#如果有bug歧义,就会在当前目录,搜索,删除

#变量扩展的改进

find $(dir_path:=/data/mysql back_data/) -name '*.tar.gz' -type f -mtime +7|xargs rm -f
  • 当变量为空,什么都不做
  • 不为空,返回后面的信息
[root@linux test]# echo $tom

[root@linux test]# echo ${tom:+6666}

[root@linux test]# tom="abc"
[root@linux test]# echo $tom
abc
[root@linux test]# echo ${tom:+6666}
6666
[root@linux test]#

实战:删除过期的数据备份文件脚本

删除7天以上的过期数据

find xargs搜索,且删除

#删除7天以上的过期数据
find需要搜索的目录 -name 你要搜索的文件名字 -type文件类型 -mtime +7| xargs rm -f


cat del data.sh
#shel1语法是否有bug
#希望删除某个数据文件夹的备份文件
#dir_path="/data/mysql_back_data/"

#如果有bug歧义,就会在当前目录,搜索,删除

#变量扩展的改进

find $(dir_path:=/data/mysql back_data/) -name '*.tar.gz' -type f -mtime +7|xargs rm -f

日常学习记录

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

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

相关文章

C语言对一阶指针 二阶指针的本质理解

代码&#xff1a; #include <stdio.h>char a 2; char* p &a; char** d &p;int main(){printf("a -> %d, &a -> %p\n", a, &a);printf("*p -> %d, p -> %p, &p -> %p\n", *p, p, &p);printf(&qu…

数据库(8)——DML数据操作

增添数据 给指定字段添加数据 INSERT INTO 表名 (字段名1&#xff0c;字段名2,...)VALUES(值1,值2...); 没有的添加的字段默认为NULL。 给全部字段添加数据 INSERT INTO 表名 VALUE (值1,值2,....值n); 此时值的顺序对应表中字段的顺序 批量添加数据 INSERT INTO 表名(字段1,…

【docker】仓库harbor的部署

harbor介绍 Harbor 是一个用于存储和管理 Docker 镜像的开源仓库。它提供了一系列的功能&#xff0c;比如用户管理、访问控制、镜像管理、日志审计和安全扫描等。Harbor 可以作为私有仓库来使用&#xff0c;也可以与公有仓库&#xff08;如 Docker Hub&#xff09;集成使用。 …

云启未来——移动云为未来开发助力

目录 前言 移动云-启未来 原生技术支持 资源和生态 智能化融合创新 移动云-安全可控 移动云如何推动未来行业变革&#xff1f; 移动云产品0元上云系列 文章总结 前言 未来的软件开发形式呈现出更加智能化、自动化和可持续化的趋势。开发工具和流程将更加注重提高开发效…

MySQL从入门到高级 --- 10.索引

文章目录 第十章&#xff1a;10.索引10.1 分类10.2 创建索引10.2.1 单列索引 - 普通索引10.2.2 查看索引10.2.3 删除索引10.2.4 单列索引 - 唯一索引10.2.5 单列索引 - 主键索引10.2.6 组合索引 10.3 全文索引10.3.1 概述10.3.2 使用 10.4 空间索引10.4.1 操作 10.5 原理10.5.1…

Java进阶:详解与实战Java Stream API

Java进阶&#xff1a;详解与实战Java Stream API &#x1f31f; Java进阶&#xff1a;详解与实战Java Stream API &#x1f31f;摘要引言一、Java Stream API介绍&#x1f4da;1. 什么是Java Stream API&#xff1f;2. Java Stream API支持的功能3. 使用Java Stream API的优势…

视频播放器-Kodi

一、前言 Kodi 是一款开源免费的多媒体播放软件。Kodi 是由非营利性技术联盟 Kodi 基金会开发的免费开源媒体播放器应用程序。 Kodi是一款免费和开源&#xff08;遵循GPL协议&#xff09;的多媒体播放器和娱乐中心软件&#xff0c;由XBMC基金会开发。Kodi的主要功能是管理和播…

mac brew 命令详解

brew 是 macOS 系统中 Homebrew 的命令行工具&#xff0c;用于在 macOS 上安装、更新和管理各种软件包。以下是对 brew 命令的详细介绍&#xff0c;按照功能和使用频率进行分点和归纳&#xff1a; 1. 安装和卸载软件包 安装软件包&#xff1a;使用 install 命令&#xff0c;后…

Golang | Leetcode Golang题解之第113题路径总和II

题目&#xff1a; 题解&#xff1a; type pair struct {node *TreeNodeleft int }func pathSum(root *TreeNode, targetSum int) (ans [][]int) {if root nil {return}parent : map[*TreeNode]*TreeNode{}getPath : func(node *TreeNode) (path []int) {for ; node ! nil; no…

五分钟”手撕“异常

目录 一、什么是异常 二、异常的体系和分类 三、异常的处理 1.抛出异常 2.异常的捕获 异常声明throws&#xff1a; try-catch处理 四、finally finally一定会被执行吗&#xff1f; 五、throw和throws区别 六、异常处理的流程 七、自定义异常 一、什么是异常 顾名…

每日练习——同余方程以及格雷码

同余方程 题目描述 运行代码 #include<iostream> #define ll long long using namespace std; ll exgcd(ll a, ll b, ll& x, ll& y) {if (!b)return x 1, y 0, a;ll d exgcd(b, a % b, y, x);y - a / b * x;return d; } int main() {ll a, b, x, y;cin >…

nodeJs上

文章目录 使用node执行js脚本文件流程示例读文件写文件 node构建web服务器流程根据不同请求路径返回不同数据核心模块模块系统ip地址和端口号的概念响应内容类型Content-type 初步实现Apache功能第三方模块 使用node执行js脚本文件 流程 1.创建js脚本文件 2.打开终端&#xf…

5月21号作业

思维导图 代码实现 TCP域套接字服务器 #include <header.h> #include <math.h>int main(int argc, const char *argv[]) {//为通信创建一个端点int sfdsocket(AF_UNIX,SOCK_STREAM,0);//参数1&#xff1a;说明使用的三ipv4通信域//参数2&#xff1a;说明使用的三…

你真的了解HTTPS协议吗

前言 在 HTTP 协议中有可能存在信息窃听或身份伪装等安全问题。使用 HTTPS 通信机制可以有效地防止这些问题。本文即将带大家来了解这些。 任何事物都有两面性&#xff0c;为了满足HTTP协议的快&#xff0c;但导致了它有如下的不足&#xff1a; 通信采用明文&#xff08;不加…

【Linux-INPUT输入的子系统】

Linux-INPUT输入的子系统 ■ input 子系统简介■ input 驱动编写流程■ ■ input 子系统简介 input 子系统就是管理输入的子系统&#xff0c; input 子系统分为 input 驱动层、 input 核心层、 input 事件处理层&#xff0c;最终给用户空间提供可访问的设备节点 ■ input 驱…

模仿高效网络进行目标检测——知识蒸馏

摘要 链接&#xff1a;https://openaccess.thecvf.com/content_cvpr_2017/papers/Li_Mimicking_Very_Efficient_CVPR_2017_paper.pdf 当前的基于卷积神经网络&#xff08;CNN&#xff09;的目标检测器需要从预训练的ImageNet分类模型中初始化&#xff0c;这通常非常耗时。在本…

【除自身以外数组的乘积】python

目录 思路&#xff1a; 代码&#xff1a; 思路&#xff1a; 直接计算前缀乘积&#xff0c;后缀乘积&#xff0c;然后相乘即可 开始我还在想&#xff0c;遍历一次i&#xff0c;怎么能同时计算前缀乘积和后缀乘积&#xff0c;事实上分开计算比较方便。。 代码&#xff1a; cl…

数据集002:眼疾识别数据集 (含数据集下载链接)

说明 病理性近视&#xff08;Pathologic Myopia&#xff0c;PM&#xff09;的医疗类数据集&#xff0c;包含1200个受试者的眼底视网膜图片&#xff0c;训练、验证和测试数据集各400张。 说明&#xff1a; 如今近视已经成为困扰人们健康的一项全球性负担&#xff0c;在近视人…

CMS Full GC流程以及调优配置

个人博客 CMS Full GC流程以及调优配置 | iwts’s blog CMS CMS 收集器是以实现最短 STW 时间为目标的收集器&#xff0c;所以对于偏业务的后台开发而言&#xff0c;基本上都无脑选CMS了。 多线程收集器&#xff0c;工作在老年代&#xff0c;采用标记清除算法。比较特殊&am…

Three.js 研究:3、创建一个高科技圆环

打开Alpha混合 修改环形颜色&#xff0c;更改发光的颜色&#xff0c;更改发光的强度为2 更改世界环境灯光