Shell scripts determine if a leap year

#! /bin/bashecho-n Input year to judge if it was a leap year:read yearlet "y1= $year% 4" let "y2= $year%" let "y3= $year% 4 XX "If [! "$y 1"-eq 0]thenleap=0elif [! "$y 2"-eq 0]thenleap=1elif ["$y 3"-eq 0]thenleap=1elseleap=0fiif ["$leap"-eq

Common commands under the shell

1.HELP displays a list of all built-in commands, or the use of a built-in command #help//View all built-in commands #help built-in commands//view built-in command usage #help-S built-in command//display the syntax format of the

Seven. Shell script programming

Shell login mode, shell arithmetic operation, Shell logic operation, shell condition test, Shell selection statementShell programming in the first line indicates the path of the shell type to be executede.g #/bin/bash1. Shell Login MethodInteractive

Jenkins+git+maven+shell implementation of Project one-click Release

First, prefaceAs is known to all, Jenkins can implement project updates by default (via SVN, but our company uses git), and projects are released through (Maven plugin), but in this case under some containers (such as Tomcat), The JVM will report

Jenkins+git+maven+shell implementation of Project one-click Release

First, prefaceAs is known to all, Jenkins can implement project updates by default (via SVN, but our company uses git), and projects are released through (Maven plugin), but in this case under some containers (such as Tomcat), The JVM will report

case where the shell handles the file name itself with an asterisk

You must enclose all the file names you get into the array, or the for loop will be parsed as a wildcard, or you can use a shell dictionary, as well as quotation marks.Shell Dictionary Example#!/bin/BashEcho "Shell Definition

Linux Shell Combat (IPCS tools)

#!/bin/Bashwhoami=' WhoAmI 'if[$#-lt"1"] then echo'[program name] [Action Object]'Exit0fi# requires two parameters, parameter one: start line, parameter two: End line, parameter three: Operation Object function seddata{ forNumxinch' IPCS | Sed-n ${1}

CENTOS7 shell script Implementation random number

Questions1. How random numbers are obtained2. How to determine the size of the random value is what we needAnswers1. Can now be obtained by obtaining the number of milliseconds of the system time, after all, the number of milliseconds changes

Shell Script Process Control

4.1.3 Shell Process Control Statements If condition judgment StatementIf ( expression ) #if (Variable in Array)Statement 1ElseStatement 2FiCase one, test if the directory exists, does not exist then new (note that space must be between the brackets)

Basic Bash Shell command--3

Environment variables in the shell become global variables and local variables. Global variables take all caps.1.printenvView the global variables for the system.Displays the value of a single environment variable using the echo command.Eg:echo

The grep command for Shell programming

grep formatgrep [Options] [mode] [file ...]-C outputs only the number of matching rows-n Lists all matching rows and displays line numbers-V Displays all lines that do not contain matching text-R Recursive Search-E supports extended regular

Linux Shell Basics

Shell is the core program kernel outside the instruction parser, is a program, colleague is a command language and programming language --shell is a command parser, the user Input command, it to parse.Shell type

Linux Service Shell environment variable path setting (CentOS)

Methods for modifying the path path of environment variables under the CentOS systemThe essential part of the computer's brain is the operating system. And the development of Linux is very rapid, there is a trend to overtake Microsoft. This article

Shell scripts to prevent sshd from being violently cracked

1, Tail-f/var/log/secureYou will find a lot of login errors. This means that your machine is being violently cracked.2. Create a new shell scriptSave exit.3, join the timing CRONTAB-EI'm judging every 10 minutes here, you can put a little longer.4.

Introduction to Linux and common commands getting started with 5--linux shell programming

Shell script to generate test dataVim data_create.shRm-rf./data.txtTouch Data.txtFor ((i=0;iDoStr= ', name ';Name=${i}${str}${i}#echo $nameecho $name >> data.txtDoneecho ' Show TestData 'More Data.txtchmod u+x data_create.shRun the scriptSh-x

Shell Basics Using Notes

Create 10 user user1-user10;[Email protected] ~]# vim user.sh#!/bin/bash #注释为bashFor ((i=1;i#条件Do #动作Useradd user$i # Add user, $i as variable (i=i+1, always execute to iecho "User$i" | passwd--stdin user$i #打印出来, create user password consistent

Shell script finds Tomcat's PID and path by path

#!/bin/bashif [!-n "$"];thenEcho-e "Usage: $ PATH"Exit 30Fi#T_P =$ (PS aux |grep "$" | grep-v-E "Grep|tomcat_path" |awk ' {print $, $ (NF-3)} ' |sed ' s/-dcatalina.home=/--/g ‘)echo "-pid-------------------PATH----"PS aux |grep "$" | Grep-v-E

Get Script Path in Shell

#!/usr/bin/bashdir_old=$ (PWD)absolute_script_path=$ (CD $ (dirname $) && pwd)relative_script_path=$ (dirname)Wrong_absolute_script_path= $dir _old/$relative _script_pathecho "Current PATH: $dir _old"echo "Absolute_script_path is: $absolute

Shell command _case

Grammar:Case "Variable" in"Variable 1")...;; #输出两个分号"Variable 2")...;; #输出两个分号"Variable 3")...;; #输出两个分号*)...;; #输出两个分号Esac 123456789101112131415161718192021222324252627 #!/bin/bash# Author:James 2016-10-15echo "want to output

Qualified Linux OPS personnel will be the 30-channel shell programming surface questions and explanations

Super depth of the shell advanced programming practice, as of the current Shell programming courses in the domestic training institutions The most fine courses, do not believe in the level of students to see the performance. course cows are not

Total Pages: 541 1 .... 409 410 411 412 413 .... 541 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.