ShellApplication TipsTips:1, command completion function: Key2, clear screen:ctrl+l3. Delete all contents before cursor:ctrl+u4. Command history: HistoricalThen:! History The command label listed, you can execute that command. Such as:! 188Also:
Using the Linux shell to get the weather, it would be difficult, originally, really simple, single-digit code is done.Get weather for the corresponding cityAll weather information is obtained from the China Weather Network. Each city will correspond
Method One:Modify the/etc/sysconfig/i18n fileChange the lang= "en_US" inside to GB2312.To restart the machine.Without restarting the method, directly# lang= "GB2312"And then we can.Modify i18n just to restart the activeMethod Two:#vi
Recently, I sent a peid shell check tool to everyone. Maybe the newbie doesn't know what this is.Let's take a look at its usage.Peid is now the most popular shell check tool. The so-called "shell" is to put a "shield" on the program, which can be
When writing shell scripts, brackets and brackets are often used. I. Parentheses, Parentheses () 1. Single parentheses. ① Command Group. The commands in parentheses will open a new sub-shell for sequential execution, so the variables in parentheses
-EQ equals
-Ne is not equal
-GT greater
-Ge is greater than or equal
-Lt is less
-Le is less than or equal
SEQ 1 30 numbers from 1 to 30
Touch-mt2010030303.03 $ dir: Modify the directory time format
STAT/tmp/1.dir view the modification time
Lines
1234567891011121314151617181920212223242526272829303132
[ -a FILE ] IfFILE If yes, it is true.[ -b FILE ] IfFILE If the object exists and is a special file, it is true.[ -c FILE ] IfFILE If a special file exists and is a word, it is
1. Variables
A. When you need to assign a value to a variable, you can write it like this:
B. To use the value of a variable, you only need to add a $ (Note: When assigning values to variables, you cannot leave spaces on both sides of "= ".)
C. Then
Simple shell script exercises
Simple Example
Conversation Script: The variable content is determined by the user.
[[Email protected] Scripts] # vi sh02.sh #! /Bin/bash # program: # user inputs his first name and last name. program
1. How to perform arithmetic computation in Shell
A = 1; B = 2
(1) Let C = $ A + $ B
(2) c = $ [$ A + $ B]
(3) c =$ ($ A + $ B ))
(4) C = 'expr $ A + $ B '(note the spaces before and after the operators)
2. Test Method
[Expression]
The line starting with "#" is a comment and will be ignored by the interpreter.
Sh does not contain comments from multiple lines. Only one # sign can be added to each line. It can only be like this:
# ------------------------------------------ #
Hbase is a distributed, column-oriented open source database. Its implementation is based on Google's bigtable theory and hadoop HDFS file system. Hbase is different from general relational databases (RDBMS ). Hbase is a column-based database
1. Define Variables
1) when defining a variable, the variable name does not contain the dollar sign ($), for example:Var = "Hello World"2) Note that there is no space between the variable name and equal sign, which may be different from all
Option name
Format
Description
-Ls
-Ls
View the current directory structure of the specified path
-LSR
-LSR
Recursively view the directory structure of a specified path
-Du
-Du
Measure the file
1. Echo Parameters
-N does not wrap (default line feed)
-E makes the transfer character valid
Example
Ss = 'abc \ n' echo-e $ ssabc # echo $ ssabc
2. When assigning values = do not include spaces on both sides
A = "hello" # error A = "hello"
3.
If the expression contains special characters, shell will replace it. For example, using variables in double quotes is a replacement, and escape characters are also a replacement.For example:
Copy text-only new window
#! /Bin/bash
A = 10
First, you must check that the shell you are using is the shell.
Echo $ Shell
Bash settings
The bash prompt is determined by the variable PS1. You need to see your own PS1 settings and run the command
$ Set | grep PS1
You can see it. Similarly,
Linux shell redirection and shell redirection
Redirects the shell error output to the standard output to record the error information of the script.
For example:
/Root/test. sh> test. log 2> & 1
Note:
Linux first loads/etc/rc. d/rc. local
[Shell] example of if, for, while flow statement and integer string comparison
Preface:
In fact, Shell is a command interpreter that explains the commands entered by the user and sends them to the kernel. In addition, Shell has its own programming
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.