Frequently used file test operators-ongoing updates
- e -- exist
File exists is True
- F -- file
File exists and is true for normal files
- D -- Directory
File exists and is directory-True
-s--size
The file exists and the size is not zero for true
-r--read
File exists and can be read as true
-w--write
File exists and can be written as true
A recent requirement was to connect to our system via OA, and then request to have the Base64 encrypted string, and the first and last position reversed, so you need to restore the normal encryption string before decrypting.So the first thing to do is to test and restore the encrypted string, that is, the first one wit
The ability to programmatically create and use string permutations is a basic software testing skill. A string arrangement is a reordering of a set of strings. For example, if your initial group consists of three strings (Apple, banana, cherry), there are six permutations:
{"Apple", "banana", "cherry"}
{"Apple", "cherry", "banana"}
{"Banana", "apple", "Cherry"}
{"Banana", "cherry", "Apple"}
{"Cherry", "ap
I. OverviewThe Shell, like other programming languages, supports a variety of operators, including:
Arithmetic operators
Relational operators
Boolean operator
String operators
File Test Operators
Second, arithmetic operatorsNative bash does not support simple math operations, but can be implemented with other commands, such as awk and expr,expr, which are most commonly used.Exp
Practice:Pass a user name parameter to the script to determine if the user's user name is consistent with the group name of their base group, and the results are displayed.(1)Character test:= =: Test for equality, equality is true, not equal to False! =: Test Whether it is unequal, not equal to true, etc as false>-N String
2743: string sentence, etc.View the total time limit for submitting statistics tips: 1000ms memory limit: 65536kB description Determines whether two strings consisting of uppercase and lowercase letters and spaces are equal after ignoring the case and compressing the spaces the input line 1th is the number of groups n for the test data, 2 rows for each set of test
I. Digital testingFormat: N1-op n2Test Operation op:EQ/NE/LE/GE/LT/GT--equals/not equals/less than equals/greater than/less than/greater than1. A numeric comparison can use a special (()) operator, which is closer to the C language, see digital testing.Two. String testS1 = S2 #s1与s2是否相同S1! = S2 #s1与s2是否不相同S1 S1 > S2 #s1是否大于s2-N S1 #s1长度是否大于0-Z S1 #s1长度是否为01. String comparison is greater than less than the s
1. Numerical comparison! /bin/Bashecho"Enter a score:"Read NUM1if[$num 1-ge the]then Echo"Very Good"elif [$num 1-lt the-A $num 1-ge -]then Echo"Good"ElseEcho" Low"fiwhich-eq equals-ne Not equal to-lt less than-le less than or equal to-GT Greater than-ge greater than or equal toEqual equals not equal does not equal less than greater greater thanElif is also the else if-A and-O OR2, ((..)) and [[...]] The useEcho"Enter a score:"Read Num2if(($num 2 >= the) then echo"Very Good"elif [[$num 2-lt the $
Enter a string, remove the occurrences of the character, and sort the remaining strings out.#include Test data:dfsfsf3345sTest results:Huawei machine Test-string to reorder
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.