[] and [[]] can determine whether the variable is empty, [ $a] [[$a]] [ ! $a] [[! $a]] No differenceIn Linux, we can use the test command to determine if a string is empty, and the test command gives us the "-Z option" and the "-N option," which you
1.1 If statement(1) If conditional statement syntax: Single branch structureif [condition]ThenInstructionsFiOrif [Condition];thenInstructionsFiIf single branch condition Chinese programming Image grammarIf [you have a room]SoI'll marry you.Fruit
1.1 How to use a file to test an expressionWhen we need to process an object in programming, we need to test the object and only take action to meet the requirements. The benefit of this is to avoid program errors and to consume system resources
Transferred from: http://blog.csdn.net/huanbia/article/details/51318278Problem description
When using SECURECRT to open Spark-shell, sometimes the following problems, when the wrong time to press the BACKSPACE (BACKSPACE) or delete (delete key),
When using Server-side git Hooks a while ago, you need to get git-submitted information, and here's a simple summary of how to get the parameters that git passes.Git 传递参数 标准输入流 passes the submitted information in or out of the form.Get parameter
#发送邮件函数function Send_mail () {#定义邮件发送列表maillist = ([email protected][email protected][email protected]) if ["$" = = "Gateway"]; Then to mail in ${maillist[*]};d o echo "Cannot ping gateway, check network" | Mail-s "PI (10.78.1.122)
Backs up all modified files in the current directory within the last 24 hours in a "tarball" (Files that have been processed by tar and gzip).The program code is as follows:#!/bin/bashBACKUPFILE=backup-$(date +%y-%m-%d)#
First, execute the command locally in JenkinsThe new project and git plug-ins in the same way, just choose the source control to use None, and then select the execute Shell module in the build , command to write the commands needed to execute
1. What is a shell?Open the system, enter ZS, press the Tab key, the command Zsoelim appears,Description No zsh command, this time can be installed, first enter the command yum list |grep zsh, enter, search,You can see that there are zsh commands,
\u indicates that the current user name \h represents the machine name \w represents the base name of the current working directory \w represents the full path to the current working directory. $, $, $, $: $ The name of this shell file refers to the
Mass production of random character filenamesRequirement: Use the For loop to create 10 batches of HTML in the/oldboy directory. Each of these files needs to contain 10 random lowercase letters plus a fixed string of Oldboy.#!/bin/bash[!-d/oldboy] &&
Receiving user parameters#./example.sh One and threeThe Shell scripting language includes variables for receiving user parameters, and based on the above command, the commonly used variables are as follows:
Use $ A To get the file name of
Bash Digital Computing--Digital processing power is critical for any programming language, but for bash shell scripts, this ability is poor, even if the form of Expr command and $[] can only be used for integer operations, the operation of
The set command sets the parameter variables for the shell. The output of many commands is a space-delimited value, and using set is very effective if you want to use one of these data fields.#!/bin/shecho the date is $ (date)Set $ (date)echo the
Exercise 1: Counting Memory usageRequirements: Write a script that calculates the amount of memory that is consumed by all processes in the Linux system. (Hint: use PS or top command)Reference Answer:#!/bin/bash# date:2018 February 6 # using top to
functionThe function is to organize a piece of code into a small unit, and give the small unit a name, when the code is used to call the name of the small unit directly.Format: function F_name () {Command}The function must be placed first, and the
Power ShellNote: The following content is written on a non-Windows platform, there may be spelling errors, if any, please correct me, I will amend as soon as possible. It can be implemented using the PowerShell configuration file (\ Profile). \)The
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.