Exercise 1:Batch Change file nameRequirements:
Find all files with the suffix. txt in the/123 directory
Bulk Modify. txt to. txt.bak
Package all. bak files into 123.tar.gz
The name of the batch restore file, that is, to remove
First the CD into a directoryTauch tset.sh//Create a new test.sh fileVim test.sh Edit ScriptI insert#!/bin/bashDataPress the ESC keyThen press CTRL +:Wq + EnterLs-l test.sh//view file permissions-rw-rw-r--1 Elasticsearch elasticsearch 18 February 8 1
Exercise 1: Generate a file every dayRequirements: please generate a daily file according to the date format (XXXX-XX-XX), for example, the file generated today is 2018-02-05.log, and write the disk usage to this file (do not consider Cron, just
BackgroundJenkins executes the shell command, which references some Jenkins variables, such as ${workspace}, because each execution of Jenkins is slow, so I want to copy the script to local debugging, directly copied the script to execute, the
First, shell special symbol Cut commandA command that intercepts a field: cut-D: followed by delimited characters, separated by single quotation marks-C: followed by the first few characters-F: The next section is followed by the number of blocks-D
Vi. condition testing and selection 6.1 test expression-file Status Test6.1.1 [-E file]File exists with a value of true;file does not exist as false6.1.2 [-D file]File exists and is a directory with a value of true;file does not exist as false6.1.3 [
The shell is a command interpreter that provides user and machine interaction before
Command historyPress UP ARROW key to appear before order historyHistory View Previous commandsThe command history exists in the file. Bash_historyThe maximum
What I want to share with you today is the "shell script", one of the knowledge points I learned in the nineth day of operations, and I've seen the teacher write some simple scripts before class, when I felt that the script was a very tall thing,
Composition + Execution
Need to add #! at the beginning /bin/bash
Lines that begin with # are interpreted as explanatory notes
The name of the script ends with. SH and is used to differentiate between this is a shell script
Experimental material:[[email protected] test]# ls//This directory contains all the files ending in. txt and requires all to be replaced by the. Doc End1.txt 2.txt 3.txt 4.txt 5.txtWriting scripts[Email protected] test]# vim/root/25.shScript content:
The grep command retrieves the rows in the file that contain keywords (which can be used), and is case-sensitive by default. Use the-c parameter to get the number of rows that contain the keywordUse the-n parameter to display the line number at the
The first is to find the file name by using a-name parameter.Query for files ending in. txt, and files that begin with T :[Email protected]:~/test$ lsone.txt three.txt two.txt[email protected]:~/test$ Find/-name ' *.txt './two.txt ./one.txt./three.
Design a script that monitors the surviving state of a remote machine (assuming IP 123.23.11.21) and sends a message to yourself when it finds an outage.Tips:1. You can use the ping command: PING-C10 123.23.11.212. E-mail script can refer to: https:/
What does it mean to move the parameter left? This parameter refers to the arguments that follow the script name when you run the script, you can use the $ #来获取参数的个数, use $* to get all the arguments, and the left side of the argument is this: there
We can pass parameters to the script when executing the Shell script, and the format of the parameters obtained in the script is:$n. n represents a number, 1 is the first argument to execute the script, 2 is the second argument to execute the script,
I. Special symbols in the shellNumber: wildcard character, can match 0 or any number of characters? Number: Tan,#号: An annotation character that is followed by a command or parameter that does not execute\ No.: Raise the meaning of the instruction
The shell's functions are the same as Javacript and PHP's function declarations, except that when the shell calls the function, it can call the function simply by writing the function name, noting that parentheses are not appended to the function
In the virtual machine Win7 system python2.7, the skier Game (code handwriting) in the parent and child is run in this Python,The following problems occur:================ restart:c:\python27\scripts\skier\skier.py ===================================
How to get started with Shell programming: how to get started with shell programming
Unlike Java, PHP, and other languages, the sh process control cannot be blank, for example:
Public class Test {public static void main (String [] args) {int a = 10;
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.