Linux base-awk, variables, operators, if

Source: Internet
Author: User
Tags logical operators

Awk

The operation of a program is a variable of some column state, which is represented by the change of variable value.

Start with a letter or underscore, and the rest can be: letters, numbers, underscores.

It is advisable to follow the following specifications:

1. Start with a letter
2. Connect the words with an underscore or an underscore
3. Differentiation of the same type with numbers
4. The best name for the file plus extension

Set and env differences
Set: Show All variables
ENV: Environment variables

Assigning values to variables

Varname=value
Echo $VARNAME
Delete variable unset VARNAME

Common system Variables

PATH
Pwd
Lang
HOME
Histsize
PS1
Ifs
The field separator is a space, wrapping, TAB key collection

Mathematical operators

+ addition operation

-Subtraction operation

* Multiplication operation

/Division Operation

% modulo operation

logical operators

< less than

> Greater than

<= less than or equal to

>= greater than or equal to

= = equals

! = does not equal

&& and

|| Or

Assignment operators

= Direct Assignment

+ = First reference and re-assignment

*= first Reference and then assign value

/= first Reference and then assign value

%= first Reference and then assign value

If syntax

if[ -D $var] Then        Echo "$var is directory"elif[ -b $var] Then        Echo "$var is block"elif[ -F $var] Then        Echo "$var is regular file"Else        Echo 'Unknow'fi

Linux base-awk, variables, operators, if

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.