ArchLinux Shell Basic Learning

Source: Internet
Author: User

The first thing to know about scripting languages is that they are usually referred to as the parser for the command line interface. (from Wiki's explanation)

Part I: Understanding the shell

You can see that #!/bin/sh and!/bin/bash are used here. But what's the difference between two people? There is an explanation.

SH is a soft connection to bash. The full parameters of the Bash command for SH are:/bin/bash--posix (Thanks Yiffy here)

Part II: Conversion commands are used

As you can see here, I used the TR Replace command (the-M is a null character, \ n means a newline).

Character wrapping, what does it look like if you don't wrap the line?

Part III: Basic Shell Awareness

Here is a basic understanding. The shell script specifies that a standard variant is defined by defining a variable:"var=" Value". Then use the "${ variable name }" ! ("${# variable name }" Plus "#" for statistical length)

Part IV: Basic System variables

PATH represents the environment variable, the PWD represents the current directory, user represents the current user, and the UID represents the current user's uid,sheel indicates that the current shell,0 represents the current file name.

Note the yellow flag, and the environment variable must be capitalized. Capital. Capital.

Part V: Writing a small judgment root program

Finally: summary has been incorrectly corrected

There is a problem with the Environment variables section. The problem is that the shell is written in Sheel, so it's not effective.

The last. This article leads you to a basic shell framework that includes interpreter awareness, substitution commands, environment variables, and a small shell judgment root program.

ArchLinux Shell Basic Learning

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.