这里我们以禁止美国地址段为例,可以根据自己的需要将us.zone改为相应国家缩写 #/bin/bash wget -O /tmp/us.zone http://www.ipdeny.com/ipblocks/data/countries/us.zone for ip in `cat /tmp/us. ...
分类:
系统相关 时间:
2021-04-19 15:10:27
阅读次数:
0
一: shell编程介绍 1、一个shell脚本运行必须要拥有r和x权限; chamod u+x 1.txt 2、运行一个shell脚本的3个步骤: (1)启动bash解释器 (2)bash把文件内容从硬盘读入内存 (3)bash把读入到内存的内容进行语法解释,控制操作系统执行shell代码 写脚本 ...
分类:
其他好文 时间:
2021-04-16 12:25:54
阅读次数:
0
secrets 替代 random import secrets num = secrets.below(10) random_num = secrets.SystemRandom().randint(0, 50) # 取0-50间的整型 random_num = secrets.SystemRan ...
分类:
其他好文 时间:
2021-04-16 11:48:42
阅读次数:
0
linux 使用trap命令进行调试 Shell脚本在搪行时,会产生三个所谓的伪信号。三种伪信号如下:信号名称 产生条件EXIT 从函数中退出,或者整个脚本执行完毕ERR 当一条命令返回非零状态码,即命令执行不成功DEBUG 脚本中的每一条命令执行之前 vi trapdebug.sh #!/bin/ ...
分类:
系统相关 时间:
2021-04-14 12:02:07
阅读次数:
0
vi proc1.sh #!/bin/bash #此脚本期望的参数个数argno=1 if [ $# -ne $argno ]then echo "Usage: 'basename $0' PID-number" >&2fi if [ ! -f "/proc/$1" ]then echo "Proc ...
分类:
系统相关 时间:
2021-04-14 11:51:22
阅读次数:
0
一个有参数但无提示说明的脚本#login1.sh: 用户登录,判断用户输入的用户名和密码是否错误 vi login1.sh #!/bin/bash for ((i=0; i < 3; i++))do read username read password if test "$username" = ...
分类:
系统相关 时间:
2021-04-14 11:41:38
阅读次数:
0
vi file_can_execute_or_not1.sh #!/bin/bash #判断输入的参数个数是否为两个 if [ $# -lt 2 ]then echo "The num of parameter is not right! " exit 0fi #判断用户输入的第一个文件是否可以读i ...
分类:
系统相关 时间:
2021-04-13 12:56:38
阅读次数:
0
vi no_interaction_script1.sh #!/bin/bash #提示用户该脚本3秒后退出echo "This script will quit after 3 seconds. " #计时3s sleep 1echo -n "."sleep 1echo -n "."sleep 1 ...
分类:
系统相关 时间:
2021-04-13 12:16:49
阅读次数:
0
vi string_array.sh #!/bin/bash city=(Nanjing Atlanta Massachusetts Marseilles) #建立一个简单的数组echo "Extracting Substring" #演示抽取子串功能echo ${city[*]:0} #抽取整个数 ...
分类:
编程语言 时间:
2021-04-13 12:08:59
阅读次数:
0
通过 lsof 命令,可以找到 Oracle 的 client 端 和 server 端的进程。 例如,我从远端连接到 oracle 数据库: -bash-4.1$ sqlplus sys/oracle@my19c as sysdba SQL*Plus: Release 12.2.0.1.0 Pro ...
分类:
数据库 时间:
2021-04-10 13:37:55
阅读次数:
0