shell
shell脚本技巧
qq_40734572
这个作者很懒,什么都没留下…
展开
-
centos下升级gcc版本
ps:安装新版本的swoole需要gcc4.8以上版本#!/bin/bash# 升级gcc到指定版本function update_gcc_by_source_code(){ # 通过源码编译升级wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.gztar zxvf gcc-4.8.2.tar.gzcd gcc-4.8.2./contrib/download_prerequisitesmkdir gcc-buildcd原创 2020-06-17 10:40:56 · 230 阅读 · 0 评论 -
shell取模运算
shell取模运算https://www.cnblogs.com/coding-996/p/12244886.htmlecho $((2%4))echo "2 % 4" | bc原创 2020-06-09 11:12:59 · 11655 阅读 · 0 评论 -
shell获取进程的运行时间
shell获取进程的运行时间#!/bin/bash原创 2020-06-04 15:33:37 · 1878 阅读 · 0 评论 -
Prometheus启动脚本
Prometheus启动脚本#!/bin/bash### BEGIN INIT INFO# Provides: prometheus# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Short-Description: starts prometheus# Description: starts the prometheus Process Manager daemon### END INIT I原创 2020-05-26 16:42:26 · 1375 阅读 · 0 评论 -
bash shell 获取数组中给定元素的下标
shell获取某个指定元素的下标#!/bin/bashfunction getArrItemIdx(){local arr=$1local item=$2local index=0for i in ${arr[*]}do if [[ $item == $i ]] then echo $index return fi index=$(( $index + 1 ))done}partitionsId=(1 2 3 4 5 6 7 9 10 12 13原创 2020-05-26 16:29:24 · 4612 阅读 · 0 评论