• Shell output all dates in two date ranges by traversing


    Preface In the normal C / C + + development, we often encounter the situation of date processing, such as calculating the number of days between two given dates or using map to store all dates within two fixed date ranges. Some time ago, the project needed to use shell script to batch process the […]

  • Analysis and prevention of the classic fork bomb of shell script


    Introduction to fork bomb As we all know, Bash is an extremely powerful shell, which provides powerful interaction and programming functions. Such a shell naturally does not lack the function element to help the program develop and manage in a modular and efficient way. Because of its special characteristics, bash has the fork bomb. Jaromil […]

  • [game production] production directory of collision survival


    brief introduction Collision survival is a collection of physical survival games on the app. Players will randomly enter the game scene and experience as much as20 creative games。 Jue Ming Express, tower shell, laser channel, etc. players need to survive in the dangerous scene until the end of the game time. After each game, players […]

  • An example of how to implement multi process running by shell script


    This article mainly shares with you the contents related to the shell script implementation of multi process operation, which is shared for your reference and learning. Let’s take a look at the detailed introduction: Example for ip in 192.168.56.{1..254} do ( ping $ip -c 4 &>/dev/null; if [ $? -eq 0 ]; then echo $ip […]

  • How to record user’s IP and command by shell


    Record the command entered The history command can view the commands entered by the user. The output of a typical history command is as follows: 980 2017-05-29 20:17:37 cd – 981 2017-05-29 20:17:41 cat index.html 982 2017-05-29 20:20:11 vim index.html 983 2017-05-29 20:39:18 cd – 984 2017-05-29 20:39:25 cd /var/log/nginx/ 985 2017-05-29 20:39:27 vim access.log […]

  • [LVS Series II of balanced load] – LVS basic configuration


    A series of articles briefly describe the five common working modes of LVS, and then mainly describe the working principle of LVS Ipvsadm and IPVS LVS is responsible for four levels of balanced load scheduling. When we want to define the scheduling rules of a cluster, we need to use a management tool, which isipvsadm。 […]

  • Generate and sign. X509.pem and. Pk8 files with shell script


    Generate. X509.pem and. Pk8 files with shell script and sign APK. There is a complete script at the end of the article —–Generate keystore file keytool -genkey -v -keystore ${KEY_STORE_PATH} -alias ${ALIASES} -storepass ${PASS} -keypass ${PASS} -keyalg RSA -validity 20000 -dname “CN=’Android’, OU=’xxx-shanghai’, O=’xxx’, L=’Mountain View’, ST=’California’, C=’US'” -Keystore path to generate file alias file […]

  • Shell, get started


    Introduction Shell is a very useful tool in Linux system. By using shell, we can improve the working efficiency of Linux system. Shell learning The code is all here: https://github.com/xiang2017/shell_study variable #!/bin/bash Variables of variables Echo “01” variable. Sh ” Variables of variables定义与赋值,等号两边不能用空格分开 name=hahahaha echo $name Echo can also use {} output: ${name} #Some special […]

  • MacOS modify terminal command line prompt method


    The Mac OS terminal command line prompt is slightly different from Linux (CentOS)!You can modify ~ /. Bash’profile to make it the same as CentOS!Add the following code at the first line of the file, where u represents the user name h represents the current computer name w represents the current directory export PS1='[\[email protected]\h \W]# […]

  • Linux shell obtains the number and position of the lines of the string


    Shell gets the number and position of the string 01 get the number of lines where the string is located Mode 1: usegrep -n [[email protected]]# cat test apple bit create delect exe flow good [[email protected]]# cat test | grep -n exe 5:exe [[email protected]]# cat test | grep -n exe | awk -F “:” ‘{print $1}’ […]

  • Linux shell script to judge whether the server network can access the Internet


    introduce When writing shell scripts, some functions need to ensure that the server network can be connected to the Internet before execution. Then a function is needed to judge the server network status We can go throughcurlVisit www.baidu.com to determine whether the server network status can be unblocked Network state judgment #!/bin/bash #Check whether the […]

  • Fundamentals of shell learning


    Shell development Shell is a bridge to communicate with computers and provides a convenient interface to use computers. The first popular shell was developed by Steven Bourne, so it’s called Bourne shell (SH for short). Later, Bill joy of Berkeley University designed a C shell similar to C language syntax. We can check/etc/shellsYou can also […]