Linux Shell Usage Notes

1. BackgroundThe Linux shell is a basic skill, because the weird syntax, combined with poor readability, is often replaced by scripts such as Python.Since it is the basic skills, it needs to be mastered. After all, the process of learning shell

Handling of shell strings

Handling strings in shell scripts1, ${#变量名}Function: Returns the length of a string# foo= "This is a test"# echo ${#foo}//Returns the length of the string foo142. ${variable name: offset:length}Function: Intercepts the string, length specifies the

Let the shell show the branch name of the current git

In the morning test script, accidentally in this article "git–setting up a remote repository and doing a initial push" see a fun thing about Git, recorded here.Add the following in the ~/.BASHRC, as prompted by the article, to let the prompt display

Shell script Add or remove user and command use method

Shell Requirements: Write a scriptOne, add 10 users user1 to User10, password with the user name, if the user exists, but requires only the user does not exist in the case can be added, in the format of/useradd.shSolution ideas: 1. Use the FOR Loop

Shell Programming Learning notes-integer self-increment

In a shell script, the case of integer self-increment is often involved in a while or for loop, and the following is a list of possible ways " Way One "declare-i to declare an integer variable [Email protected]:~# declare-i x=1

Shell script Batch Start zookeeper

Script name is zk_run.shPaste the following code into the zk_run.shAdd Execute permissions chmode +x zk_run.shRun the script./zk_run.sh startIf you find that zookeeper is not starting up, try adding the following line at the top of each zookeeper

Shell M3u8-->ts

Shell:m3u8-->ts Requirement: Known bulk m3u8 uri for full TS file uri #由于sed不支持文本替换, generate temporary files test_file#curl -s  ignore the default output as follows #  % total    %  Received % Xferd  Average Speed   Time    

Powerful and usable shell

Linux kernel is responsible for driving hardware, management activities and allocation/management of hardware resources and so on, so that the system to check the normal operation of the computer is really too important, so it is generally not

Shell Script--LNMP Architecture-real-combat deployment

shell Script Combat----One-click Deployment LNMP ArchitectureLNMP uses the shell to deploy, directly on the topic, first needs to prepare the package files, which I named here as Zhunbei files.650) this.width=650; "Src="

Shell scripts-Simply add users and count the total number of users

Script Name: Test4.txtCd/optmkdir SHELLLSVI Test4.txtThe script reads as follows:#!/bin/bash[! $#-eq 1] && echo "Args is Error" && exit 5id &>/dev/null && echo "User $ exist "&& exit 2id &>/dev/null | | Useradd $1id $ &>/dev/null && echo "$"

Shell Command Basic knowledge point

Command history# Cat/root/.bash_history//place where historical commands are stored# History//View the number of command histories# echo $HISTSIZE//View the number of bars that can be saved# Vim/etc/profile//Change the value of variable histsize

Shell Scripting Normalization, standardization

1. Write more comments in the script             This is a recommended practice that can be applied not only in shell scripts, but also in all other types of programming.              commenting in a script can help you or others to read your script

7 Ways to use shell functions

1. Define the function and reference inside the shell file:Copy CodeThe code is as follows:[~/shell/function]# Cat factorial.sh#!/bin/bashfunction factorial{Factorial=1For ((I=1;i Dofactorial=$[$factorial * $i]DoneThe factorial of Echo $ is:

Execution of shell scripts with Echo yongming

Script execution1. Give execution permission to run directlychmod 755 hello.sh./hello.sh #需要使用文件的绝对路径或相对路径2. Execute script via bash callEcho Output commandSyntax: Echo [-e] [output CONTENT]-E: Character conversions that support backslash controlEG1:

Shell uses the Paste command to stitch multiple files by column

Test documents:[email protected] shell-script]# cat Text1.txt12345[email protected] shell-script]# cat Text2.txtOracleMysqlPostgreSQLHadoopSparkUsing Paste stitching text1.txt text2.txt file contents:# paste Text1.txt text2.txt1 Oracle2 MySQL3

Shell awk Command

Grammar:awk ' {command} ' filename multiple commands are separated by semicolons .awk ' begin {Command1} {Command2} End{command3} ' Note: Begin, END needs to be capitalizedCommon Variable Description:FS: Specifies the delimiter, which is the default

Shell Test Statements

Test statement format: [conditional expression] Subdivision Test statements are: File test, logic test, integer value comparison, String comparison------------------------------------------------------------------------------------file test:

Use of the grep command for Shell programming

Before you learn the regular expression, be clear and keep it in mind:In Linux, wildcards are interpreted by the shell, while regular expressions are interpreted by commands, so don't confuse them. Remember!!!usually have three text Processing tools/

Turn: Linux under Shell display-bash-4.1# does not show path resolution

Several possible causes:1 The user's home directory belongs to a group that has been renamed Root, and the solution uses root to perform Cd/home/;chown username:username username2 The user's home directory was modified, this time if you want to

Shell Regular Expression

What is a regular  A regular is a way to describe a character or string by combining symbols with special meanings, called regular expressions. Or, the regular is the rule used to describe a class of things.There are regular things in life:For

Total Pages: 541 1 .... 264 265 266 267 268 .... 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.