The meaning of $ symbol in various programming languages--related skills

Source: Internet
Author: User

0 Preface

The recent development process used a variety of scripting languages, found in these languages a lot of the $ symbol, and the $ symbol for each script language is not the same use and meaning, so borrow Bowen summary. Makefile scripts and shell scripts are often used in Linux application development, interestingly, there are significant differences in the use of $ notation between the two scripts, although in both scripts $ is associated with variables, but in makefile variables are wrapped in parentheses, and the shell script missing does not require parentheses.

1 shell Script

Defining variables

Copy Code code as follows:

Var=<value>

Using variables, variable names do not need to use parentheses to wrap
Copy Code code as follows:

$VAR

Example
Copy Code code as follows:

Url= "Http://www.jb51.net"
Curl-i $URL

2 Makefile

Defining variables

Copy Code code as follows:

Var=<value>

Using variables, variable names need to be wrapped with parentheses
Copy Code code as follows:

$ (VAR)

Example--Define a constant macro in makefile
Copy Code code as follows:

DEFS =-dtest
Cflags + = $ (DEFS)

3 jquery

$ represents the shorthand for jquery,
Example--Print a string to the console after page load completes

Copy Code code as follows:
$ (document). Ready (function () {
Console.log ("Hello JQuery");
});

4 PHP

All variables in PHP begin with the $ symbol.

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.