Initial knowledge of the shell

Source: Internet
Author: User

Words do not say much, straight to the subject, LZ is not bad at writing an article, just record their own learning process in a bit drops.

Note: The shell is sensitive to case letters.

Open terminal appears: [email protected]$ Span style= "font-family: the song Body;" > or [email protected]#   $ # $ # root linuxsystem root shell

Two ways to run the script:

First type:$ bash script.sh or $ bash/home/path/script.sh # text comment, in current directory

The second type: Set script executable permissions,$ chmod a+x script.sh meaning is to give all users script.sh file executable permissions, execution mode:

$./script.sh #./ represents the current directory

Or

  $/home/path/script.sh

In Bash , each command is delimited by using a semicolon or a newline.

Cd.. go to the previous level directory ( Note: There is a space in the middle, and the DOS Command of window is a little different window DOS command CD below: and the CD.. can go back to the previous level of the directory )

Terminal Print Basic command: Echo

Text output can be printed directly on the terminal by either double quotation marks or single quotation marks.

Practical demonstrations such as:

But there are side effects to this red box, so the solution is to output directly, use single quotes, or escape characters (\).

Induction:

When you use echo without single quotes , you can't use semicolons in your text (;), because semicolons are used as command qualifiers in the Bash Shell .

Variable substitution is not valid in single quotes, post-discussion.

Initial knowledge of the shell

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.