Shell Script 100 Example "one"

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 in the shell

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

The role of various parentheses in the shell (), (()), [], [[]], {}

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

Shell Script--loop structure

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

How to switch the shell environment

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-8.13 Shell Special Symbol

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

Shell Script implementation: 5 per week using the tar command to back up all log files under/var/log

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

Shell echo Command

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

Shell's declare defining variables

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

20.Shell Introduction, History,tab key, wildcard, redirect

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

Server auto-patrol shell script

#!/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

Examples of ${}, #, # #,%, percent of% in the shell

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

[Svc]shell Script

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 contains

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 (.)

Shell Script Programming Learning notes (i)

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 Basic syntax:

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以.

Shell special symbol, Wc,uniq,tee_tr_split command

[[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

Shell programming, backing up files across servers

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

Java operation Linux, invoke shell command

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

Sorting algorithm--shell sorting

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

Total Pages: 541 1 .... 212 213 214 215 216 .... 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.