that cannot view a child process)
Shadow default permission 000 but root is read-writable by Superuser, but if the file does not have X permissions, root cannot execute
Two, arithmetic operator
Arithmetic operators in bash: + 、-、 *,%, * * (squared) Note: "*" to escape "\*" when using expr
To implement arithmetic operations:
Let-var= arithmetic expression
var=$[Arithmetic expression]
var=$ ((arithmet
There are many shell operators, relational operators, arithmetic operators, Boolean operators, string operators, and file test operators1, arithmetic operatorsAcoustic Bash does not support simple arithmetic operations, and you can use the Expr toolTwo points Note:
There are spaces between the expression and the operator, such as the 2 + 2, which is diff
established canLogical Non! Take the number-Z to empty! -Z plus an exclamation mark is not null[5-GT 6] | | [7 lt 8] | | [0-lt 1]Or[5-gt 6-o 7-lt 8-o 0-lt 1]Whether the process control is performed depends on whether the judgment result of the condition is true. Condition to judge the result to be true,Process Control will not be executed, otherwise it will not execute. Make judgments about different objec
Shell test command test, [], [[], shell test command test
Directory:
1.1 conditional expressions
1.2 usage of test and []
1.3 [[]
1.4 usage suggestions
when using the Shell's logical operator "[]", you must ensure that there is a space between the operator and the arithmetic. Arithmetic can only use: let,expr and other commands to complete.Today's statement of the double-brace "(())" structure is an extension of the arithmetic and assignment operations in the shell. 1. Syntax:(expression 1, expression 2 ...)2. F
Day3 java operator and process control, day3 Operator
Value assignment
Assignment operator: =, + =,-=, × =,/=, % =
Class fuzhiyunsuan {public static void main (String [] args) {int i1 = 10; i1 + = 3; // i1 = i1 + 3, however, there is a difference between the two. // For example, the following short s = 10; // s = s + 3
2! = "3"; Thenecho "Not Equal"FiHere is the " not " operator ! The IF condition is true when executed, if used! operator, the original expression must be falseif! Test $var 1! = "1"; Thenecho "Not 1"FiThe above three if are true, so three echo will printExample:[JavaScript]View Plaincopyprint?
#!/bin/sh
Aa="August, "
bb="August, 20122"
cc="123"
dd
each expression with "," separate
Usage examples:
Extended arithmetic
1234567891011
#!/bin/sha=1;b=2;c=3;((a=a+1));echo $a; a=$((a+1,b++,c++));echo$a,$b,$c
Operation Result:
SH testsh.sh23,3,4
Multiple expressions are supported between the two-parenthesis structure, which is then supported by common C-language operators such as subtraction. If the double parenthesis Band: $, the expression value is obtai
important Bourne shell operators.
There are the following operators that we are going to discuss:
· The arithmetic operator.
· The relational operator.
· Boolean operator.
· The string operator.
· File Test action.
The Bourne
, $b, $cRunning result:]# sh testsh.sh23,3,4 supports multiple expressions between the two-bracket structures, and then the C-language common operators such as subtraction are supported. If the double parenthesis Band: $, the expression value is obtained and assigned to the left variable.Extended Logical Operations#!/bin/sh a=1;b= "AB"; echo $ ((a>1?8:9)); ((b!= "a")) echo "ERR2";((aOperating result:]# sh testsh.sh9err2okExtending Process Control sta
This article mainly introduces the shell commonly used operator Summary, this article explained the arithmetic operator, the relational operator, the test operator and so on content, needs the friend to be possible to refer to und
In Linux shell programming, it is often used to determine whether a string is equal, the operator that can be used to determine whether a string is equal (equal), ' (not equal To), ' (less than), ' (Less -eq -ne -lt -le than or equal -gt to), ' (greater than) or ' -ge (greater than or equal to), and =,==,!=,In the Bash guide, the letter operator and the symbol
terminal number, this is more commonly used
\m
Displays hardware architectures such as i386, i686, and so on.
\ n
Display host Name
\o
Show Domain name
\ r
Show Kernel version
\ t
Show current system time
\u
Displays the serial number of the currently logged on user
② Remote Terminal welcome information: /etc/issue.netA. Escape character cannot be used in the/etc/issue.n
1. Weaknesses of Shell variables: weak type and default string type2. Declare command2.1 Declare declaring variable type declare [+/-] [option] Variable name 2.1.1 Declares a numeric type variable: declare-i c= $a + $b # A and B are not declared or can be2.1.2 declaring an array variable: 2.1.3 Declaring environment variables: Declare-x a=123 # is similar to export, but it's all part of the DECLARE command.2.1.4 Declaration Variable read-only
Shell Process Control and shell Process
Unlike Java, PHP, and other languages, sh process control cannot be blankIf elseif statement syntax format:
if conditionthen command1 command2 ... commandN fiWrite a line (applicable to terminal command prompt ):
if [ $(ps
Shell Command and process control, Shell command Process Control
Shell commands and Process ControlThree types of commands can be used in shell scripts:
1) Unix command:Although any uni
Test options and test commands for shell notes: Shell code #! /Bin/bashwww.2cto. comecho file comparison operator echo operator description example echo-efilename if filename exists,... Info
~]# let x+=5 [add 5 for x value]
[root@server0 ~]# echo $x
10
Let x*=5 [for x value morning multiply 5]
Let x/=5 [divide the value of x by 5]
Let x%=5 [for x value]
4.bc [Calculator]
5+5
10
5. Take the small tree point after the x bit
Scale=x
Take two decimal places
[root@server0 ~]# echo "scale=2;2/10" | bc
.20
6. Compare: test or [par
The following is an explanation under the bash environment.One, single parenthesis ()Two, double parenthesis (())Can be used as a numerical condition or as a numerical operation (approximate to let command)Like the C language syntax, supports operators:Three, single brackets [][] is actually shorthand for the test command in bash, where [expr] is equivalent to test exprNumerical tests:-eq,-ne,-gt,-lt,-ge,-l
Test switch and special parameters in Shell script, shell script1. Test Switch
The following table lists the meanings of the test commands and whether they can be used in test commands, bash, and ksh.
Switch
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.