Three: Shell operators

Source: Internet
Author: User

1:declare command

shell Default is String type
If subtraction is required, it needs to be defined as an integral type
DECLARE command: Change the default variable type Decalre [+/-] [option] Variable name
-set type properties for variables
+ Cancel Variable Type property
-a declares an array type
-I declaration as Integer
the-X sets the variable to an environment variable equivalent to the Export command Declare-x test=123 (export is a simplified command. The final execution is the declare-x command)
-R variable declared as read-only variable
- p Displays the declared type of the specified variable
eg:
declare-i cc= $aa + $bb
Echo $CC
-
View variable properties declare-p cc
eg:
declare-p cc
declare-i cc= "

Array:

Movie[0]=zp
Movie[1]=tp
Movie
-bash:movie:command not found
echo $movie [1]
Echo ${movie}
Zp
Echo ${movie[1]}
Tp
Echo ${movie[*]}
ZP TP
[Email protected] ~]#

2: Array Operation method

3. Variable Testing

The variable test method, which only takes effect for the shell, does not exist in other general languages.

Three: Shell operators

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.