1. Record the command:!!! : Continuous "! "indicates that the last instruction was executed! N: Represents the second instruction in the execution of the command historyNote:! 2 actually shut me down.! String (string greater than 1) indicates the
The shell is the preferred system administrator for its stability, efficiency and flexibility.1. Shell Introduction:Command line: Refers to the interface for the user to enter a command, which itself simply accepts input and then passes the command
When we learn is the first to realize that we learn the shell is used to do what, it and other programming languages are different and advantages, do not blindly study, and finally do not know what the purpose of learning shell is to do. Let's start
#!/bin/bashif [[$# = = 0]];thenecho "Error: Please enter the number of days to query???"Elseecho "Temporarily does not support the 7 version of CentOS!!! "now_time_cuo=date +%s((end_time_cuo=${now_time_cuo}- echo $1*3600*24 | bc ))Now_time=date |
Exercise 1:Statistics Log size If we need to execute the script you wrote every hour. In the script to implement such a function, when the time is 0 and 12 points, you need to empty the file under directory/data/log/, notice can only empty the
Exercise 1:Find patterns to print numbersRequirements: Please review the rules of the following numbers in detail and use the shell script to output the following 10 digits. 10 31 53 77 105 141 .....Hint: The difference between the two adjacent
Title requirements:Write a script to enter personal information/root/bin/information.sh, the requirements are as follows:1. Prompt the user to enter username (need to check the name of the character, the user name can not be blurred contains any of
Exercise 1:Enter a number to execute the corresponding commandRequirements: Enter a number and then run one of the corresponding commands. The commands shown are as follows: *cmd meau* 1-date 2–ls 3–who 4–pwd; when input 1 o'clock, run date, enter 2
Batch Create 10 system accounts (OLDBOY01-OLDBOY10), and set the password (password is random number, the requirement is a mix of characters and numbers)To create a random password:#echo $RANDOM | Cut-c 3-9and write the user name and password to a
Signal list:Common commands related to Linux and signaling are the kill and trap commands, down how to use traps to control the springboard script using the command:Command: Kill-l and Trap-lImportant signal and explanation of Linux system in
Exercise 1:Delete the letters in the textRequirements: Delete the line containing the letters in the first 5 lines of a text document and delete all the letters from 6 to 10 lines (file 1.txt, lines greater than 10 lines)Reference Answer:#!/bin/bash#
Using Nginx log file to count all IP and PV, list the top 10 IP, take confluence Knowledge base system as an example:Nginx log file is/var/log/nginx/access.log# wc -l /var/log/nginx/access.log 95146 /var/log/nginx/access.logShell script:# vim
$0, $? In Shell scripts? , $! , $, $ *, $ #, $ @, Etc.
$0 indicates the execution name of the program. The file name of the current script $ n indicates the nth parameter value of the program. n = 1 .. 9 $ * all parameters of this program. This
Is the shell script used to determine whether the strings are equal? (Code instance), shell scriptShell script to determine whether the strings are equal
Basic Elements
1) Declaration of variables 2) Use of if Statements 3) Use of echo
2. The
Shell scripts automatically log on to the server and install JDK (Code tutorial), shelljdk1. Write the installation script
Install. sh
! /Bin/bashURL = "https: // ***/jdk-8u161-linux-x64.tar.gz "yum install-y wgetwget $ URLtar-zxvf jdk-8u161-linux-
An example of passing parameters in Shell programming and an example of shell Parameters
When executing a Shell script, we can pass parameters to the script. The parameter format obtained in the script is $ n. N indicates a number. 1 indicates the
Shell programming echo command usage instructions, shell programming echo command
Shell echo commands are similar to PHP echo commands and are used to output values. We can use echo to implement more complex output format control.Show normal
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.