1. Write the Hello World script#!/bin/bashecho "Hello World"2. Create a Linux system account and password with location variables#!/bin/bash#$1 is the first parameter to execute a script, and the second argument to execute the scriptUseradd "$!"echo
Regular Expressions (regular Express)The expression of a rule, which is to represent data with the same characteristics with some pre-defined symbols, almost all programming languages use regular expressions (regular) and are common in different
One, parenthesis, parentheses ()1, single parenthesis ()① Command Group. The commands in parentheses will be executed in a new sub-shell sequence, so the variables in parentheses cannot be used by the rest of the script. Multiple commands in
The Shell's loop structure has while and for two typesWhile loopWhile following the judgment condition, the judging condition can be more than one, but each judgment condition should be enclosed in a separate [], and then multiple judgments are used
To view the commands for the terminal tool:echo $TERMThe returned results are as follows:xterm-256color
To view the command for the shell environment:echo $SHELLThe returned results are as follows:/bin/bash
Switch the shell environment: chsh
8.10 Shell Special symbol Cut commandSpecial symbols (top):A 1.* represents 0 or more arbitrary characters.2. Represents only one arbitrary character ( whether it is a number or a letter, as long as it can be matched. )3.# This symbol in Linux
Simple little script, big God DetourImplementation steps:1 Writing scripts2 Doing recurring planning tasks1 scripting[Email protected] ~]# vim tar.shScript content:#!/bin/bash#编写备份脚本, the file name contains a date label after the backup, preventing
The echo command of the Shell is similar to the echo command of PHP, and is used for the output of strings. Command format:echo stringYou can use echo to achieve more complex output format control.1. Display Normal string:echo "It is a test"The
Experimental environmentCommand descriptionThe declare and typeset commands are bash's built-in commands (BUILTIN commands), both of which function exactly the same way to set variable values and properties.Typeset is now deprecated and replaced by
Five Week third session (January 10)
8.1 Shell Introduction
8.2 Command History
8.3 Command Completion and aliases
8.4 Wildcard Characters
8.5 Input and output redirection
Shell IntroductionThe shell is a command
#!/bin/sh# defines a function that checks the operating system version num_version=$ (UNAME-R) function check_os () {[[ $NUM _version =~ el6 ]] && return 0| | return 1}echo "##### #CPU使用情况 ######" cpu_hardware=$ (cat /proc/cpuinfo | grep name
DescriptionI believe that in the work, many friends in the use of shell scripts encountered ${},%, #等这些字符的使用, and occasionally they will be dizzy, and then I use the following example to let everyone very well remember the Shell ${}, # #和 percent
I will regularly collect some good shell and PY scripts to see here, for reference learning:Shell resources:Https://github.com/lannyMa/ops_doc/tree/master/LazyManageCheck Help
Chinese Culture sh
yum install man-pages-zh-CN -yecho 'LANG=
The Shell file containsLike other languages, the Shell can also contain external scripts. This makes it easy to encapsulate some common code as a standalone file.The Shell file contains the following syntax format:. FileName # Note number (.)
First, the script formatVim shell.sh#!/bin/bash//Declaration script interpreter, this ' # ' is not a comment, the rest is a comment#Program://program Content description#History://Time and authorIi. Types of Shell variablesUser-defined variables:
Shell Script Programming Syntax:Note:Article source http://www.cnblogs.com/yunquan/p/6821850.htmlVideo Source: https://www.bilibili.com/video/av10565321/index_1.html?t=684Each statement here must have a space control, or syntax error 1. file format以.
[[email protected] ~]# cut-d:-F 3/etc/passwd-d: delimiter-F plus number paragraph F is the first paragraph012[[email protected] ~]# cut-d:-F 3,4,5,6,7/etc/passwd can choose a few more paragraphs plus, you
Requirements: Query all files under a folder, change the file modification time to less than the current time, and be larger than the current time the previous day of the file backup to another server corresponding to the folderIdeas:1, recursive
Importorg.junit.jupiter.api.Test;ImportJava.io.BufferedReader;Importjava.io.IOException;ImportJava.io.InputStreamReader;ImportJava.io.OutputStreamWriter;ImportJava.io.PrintWriter;ImportJava.util.logging.Level;ImportJava.util.logging.Logger; Public
Second, the shell sortThe shell sort is also called "Reduced incremental Sort" (disminishing increment sort), based on the insertion sort.The shell suggested sequence is a common but not ideal increment sequence:1,...,n/8,n/4,n/2
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.