tailieunhanh - Mastering unix shell scripting p2

Kiểm tra một địa chỉ IP hợp lệ và không hợp lệ INVALID = FALSE riêng biệt phần số nguyên của địa chỉ "IP" và kiểm tra để đảm bảo rằng không có gì là lớn hơn 255 # hoặc nó là một địa chỉ IP không hợp lệ. | 48 Chapter 1 then This error would be a programming error print ERROR basename 0 requires one argument return 1 fi Assign argl to the variable -- STRING STRING 1 This is where the string test begins case STRING in 0-9 . 0-9 . 0-9 . 0-9 Testing for an IP address - valid and invalid INVALID FALSE Separate the integer portions of the IP address and test to ensure that nothing is greater than 255 or it is an invalid IP address. for i in echo STRING awk -F . print 1 2 3 4 do if i 255 then INVALID TRUE fi done case INVALID in TRUE print INVALID_IP_ADDRESS FALSE print VALID_IP_ADDRESS esac 0-1 Testing for 0-1 only print BINARY_OR_POSITIVE_INTEGER 0-7 Testing for 0-7 only print OCTAL_OR_POSITIVE_INTEGER 0-9 Check for an integer print INTEGER -0-9 Check for a negative whole number print NEGATIVE_WHOLE_NUMBER 0-9 . 0-9 Scripting Quick Start and Review 49 Check for a positive floating point number print POSITIVE_FLOATING_POINT 0-9 . 0-9 Check for a positive floating point number with a prefix print POSITIVE_FLOATING_POINT - 0-9 . 0-9 Check for a negative floating point number print NEGATIVE_FLOATING_POINT Check for a negative floating point number print NEGATIVE_FLOATING_POINT .0-9 Check for a positive floating point number print POSITIVE_FLOATING_POINT a-f Test for hexidecimal or all lowercase characters print HEXIDECIMAL_OR_ALL_LOWERCASE a-f 0-9 Test for hexidecimal or all lowercase characters print HEXIDECIMAL_OR_ALL_LOWERCASE_ALPHANUMERIC A-F Test for hexidecimal or all uppercase characters print HEXIDECIMAL_OR_ALL_UPPERCASE A-F 0-9 Test for hexidecimal or all uppercase characters print HEXIDECIMAL_OR_ALL_UPPERCASE_ALPHANUMERIC a-f A-F Testing for hexidecimal or mixed-case characters print HEXIDECIMAL_OR_MIXED_CASE a-f A-F 0-9 Testing for hexidecimal alpha-numeric strings only print HEXIDECIMAL_OR_MIXED_CASE_ALPHANUMERIC a-z A-Z 0-9 Testing for any alpha-numeric string only print ALPHA-NUMERIC a-z Testing for all lowercase characters only print ALL_LOWERCASE A-Z .

TỪ KHÓA LIÊN QUAN