today accidentally hit the home directory Delete command, although finally for a variety of reasons did not delete, but the home directory, many files and directories are deleted, and the command line does not display the current user and path.
1.5 using the shell for mathematical operationsIn any programming language, arithmetic operations are essential, and the shell is no exception.1.5.1 arithmetic operations using Let, (()), and []
You can use the normal variable assignment
1.3 Playing variables and environment variablesvariables are an essential part of any programming language and are used to store variables of various types. Scripting languages are mostly weak type languages (dynamic languages), meaning that when
1. PrefaceAlmost half a year did not write a blog, wasted a long time, work in the chores too much, their own more and more lazy. In order to spur their own growth, or to insist on writing a blog, record their growth.2. Shell Function
1. Check the current system who is logged in: Who2. Count the logged-in users of the current system: who | Wc-l (L-->line,w-->word,c-->character)3. Small shell script development cycle: $cat > Nusere new file, using Cat copy terminal inputW.H.O. |
While loop:Format OneWhile condition;DoStatementDoneFormat Two dead loopsWhile TrueDoStatementDoneFormat three dead LoopsWhile:DoStatementDoneFormat Four dead LoopsWhile [1]DoStatementDoneFormat Five Dead LoopsWhile [0]DoStatementDone****************
Test command usage:1) Judgment expressionif test (expression is true)if test! An expression is falsetest expression 1–a expression 22 expressions are truetest expression 1–o expression 22 expressions have a true2) Judging the stringtest–n String
1. Shell FeaturesOrder history!! !$!n! characterTab key to complete file path or commandAlias a= "B" Unalias AWildcard * Matches 0 or more characters? Match one characterInput/Output redirection >,>>,,2>>Pipe characterJob Control CTRL + Z jobs FG BG2
determine if a string is empty inside the shell Category: Linux shell2011-12-28 23:18 15371 people read reviews (0) favorite report ShellThere are several main ways to do this:echo "$str" |awk ' {print length ($)} 'Expr Length "$str"echo "$str"
The shell has conditional test statements, which are usually done using the test command or the [] command, which is the basis of the conditional Judgment statement If~then statement, especially the [] command. Let's explain some of the conditional
The default value in the shell is decimal, so how are binary, octal, and hexadecimal represented?Method 1: Use the prefix.0 begins with octal, and 0x starts with hexadecimal.As follows:#-----------------------------/chapter4/ex4-35.sh----------------
There are several ways to execute the shell script1, relative path mode, you need to first CD to the script path[[email protected] tmp]# Cd/tmp[[email protected] tmp]#./ceshi.sh Script Execution succeeded2. Absolute path mode[[email protected] tmp]#/
Installing ClustershellInstall from https://github.com/cea-hpc/clustershell/downloads below source or binary package. The following is an example of CentOS6.6 using RPM installation: wget
1. #注释作用, #! Except in addition, in the parameter replacement echo ${path#*:} here does not represent the comment, the numeral conversion, does not represent the comment echo $ ((2#101011)) 2. Command line delimiter, you can write multiple commands
This article turns from: http://www.jb51.net/article/56548.htm This article mainly describes how many parameters the shell supports? This article is a test article on how many parameters a shell can enter, and the friend you need can refer to the
4. Input and output#! /bin/bash# Read users input and then get his nameread"Please input your first name: " firstNameread"Please input your last name: " lastNameecho-e"Your full name is: $firstName $lastName"Read usage:read[-ers][-a 数组][-d
Format: Echo"/033[Word background color; font color m string/033[control code"If you simply display the font color can be fixed control code bit 0m. Format: Echo"/033[Word background color; font Color m string/033[0m"Word Background color range:40-49
Several methods of shell script execution, shell scriptYou can execute shell scripts in the following ways:
1. The relative path method must be cd to the script path first.
[Root @ banking tmp] # cd/tmp [root @ banking tmp] #./ceshi. sh script
[Linux] shell multi-process concurrency-version details, linuxshell Business background
The schedule. sh script schedules the execution of the user's trajectory project script. Part of the Code is as follows:
#! /Bin/bashsource/etc/profile; export
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