The test command is very powerful, but it is difficult to satisfy its escape requirements and the difference between string and arithmetic comparisons.
Greater than
Less than
Equals
Not equal to
If ["$a"-gt "$b"]
I. OverviewThe shell is a program written in C that provides access to the operating system kernel services through a shell user. It is similar to DOS command and later cmd.exe. The shell is both a command language and a programming language.Shell
When executing shell script, if judgment statement error#!/bin/bashif [0 = = $testNum]then echo "Check result:0" fi Testnum is not defined when used, no assignment is empty (originally defined, just a clerical error is similar to tsetnum), after
在study(Shell)专栏中,会深刻学习到shell编程And as an OPS person, the most basic ability is to learn shell script programmingTo improve efficiency in our work!Shell Programming:Compiler: Also called interpreterThe shell provides us with another function: To
1, guess the number: first let the system randomly generated a number, give this number to a range (the number of the first 50 and 50), let the user input guess the number, the input judgment, if not meet the number to give high and low hint,
Tilde expansion with wildcard characterstwo types of expansion in the shell that are related to file names . The first one is the wave number expansion . , The second type is a wildcard expansion .Wave Number expansion If the first character of the
If the expression contains special characters, the Shell will replace it. For example, using a variable in double quotes is a substitution, and an escape character is also a substitution.As an example:
#!/bin/bash
A=ten
echo-
Operator
Describe
Example
File comparison Operators
-e filename
True if filename exists
[-e/var/log/syslog]
-D filename
True if filename is a directory
[-d/tmp/mydir]
Before writing the IF condition to judge, generally in writing the shell script may use the dead loop at this time need while statement, it is the best way to do the dead loop, before the while loop need to tell the file test, because it is often
In shell, there are three types of quotation marks: single quotation marks, double quotation marks, and reverse quotation marks.
Single quotation marks 'all characters enclosed by single quotation marks are common characters. When special characters
Document directory
Task: display current bash prompt (PS1)
Task: modify current bash prompt
Task: add colors to the prompt
Task: how to make the prompt setting permanent
Tput command
Handy tput commands
Colors {code} code for tput command
Sudo addgroup hadoop # Add a hadoop GroupSudo usermod-a-g hadoop Larry # Add the current user to the hadoop GroupSudo gedit ETC/sudoers # Add the hadoop group to sudoerHadoop all = (all) All after root all = (all) All
Modify hadoop Directory
Linux Command Line and shell script Programming
This time, I read the Linux Command Line and shell script programming book for 3rd Times. In general, this book is quite good. It is suitable for beginners. I also learned about shell programming from
Author: gnuhpcSource: http://www.cnblogs.com/gnuhpc/
Offline backup/restore the TDS
1. Preparation (1) logon to the server as root.(2) open a terminal, check if there is the script named tarbackup. Sh in/usr/local/bin directory(3) make sure you
Differences between console, terminal, tty, shell, and other concepts
Linux has been used for some time, but I still cannot understand the differences between these concepts. Although I have been using it all the time, many concepts are vague, so it
Shell-encrypted shc vulnerability and shell-encrypted shc Vulnerability
Recently, I have been compiling Shell scripts for customers to use. I will inevitably encounter some sensitive information that I don't want them to know. So I used Shc script
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