案例一:忽略中断 (同时按下 “ctrl” 键和 “c” 键) 信号
trap '' INT
案例二:设置 EXIT 信号
end() {
echo "This script is over"
}
trap end EXIT
(补充:这里以将 EXIT 信号设置为 echo “This script is over” 为例)
trap '' INT
end() {
echo "This script is over"
}
trap end EXIT
(补充:这里以将 EXIT 信号设置为 echo “This script is over” 为例)
1) declare、typeset 和 local 的作用都是声明脚本中的变量
2) local 只能用在函数内部
3) declare、typeset 和 local 的选项一样
declare <OPTION> <NAME1>=<VALUE1> <NAME2>=<VALUE2> ......
1) -g 指定要声明的变量为全局变量而不是局部变量
2) -I 给变量赋值时将值转化为小写
3) -u 给变量赋值时将值转化为大写
continue 的作用是在 for、while 等循环中,跳过这次操作直接进入下一个循环
return 的作用是退出函数
exit 的作用是当此脚本正在运行时退出此脚本
> SHOW STATUS LIKE 'Threads_connected';
> SHOW VARIABLES LIKE 'max_connections';
> SET GLOBAL max_connections = 200;
(补充:这里以临时将数据库目前所允许的最大连接数设置为 200 为例)
> SHOW PROCESSLIST;
> SELECT * FROM performance_schema.threads;
(步骤略)
(步骤略)
(步骤略)
/init: error while loading shared libraries: libsystemd-shared-239.so: cannot open shared object file: No such file or directory
kernel panic - no syncing: Attempted to kill init! exitcode=0x00007f00
# ldconfig -p > /tmp/ldconfig.out
# for l in $(awk '{ print $1 }' /tmp/ldconfig.out); do matches=$(awk "\$1 == \"$l\" { print }" /tmp/ldconfig.out); if [ $(echo "$matches" | wc -l) -ge 2 ]; then echo "$matches"; echo; fi; done
(补充:如果没有第三方软件库的话这里不会有任何输出)
(步骤略)
# ldconfig
# dracut -f /boot/initramfs-(uname -r).img $(uname -r)
(补充:这里以将正在运行的内核版本生成一个新的 initramfs 为例)
(注意:此时原来启动系统时使用的那个 initramfs 文件会被覆盖)
# reboot
https://access.redhat.com/solutions/7096246