"LINUX SHELL" Note 01: Don't think, do it!

Source: Internet
Author: User

"Must be finished this time" series? Section--linux SHELL script Raiders. (Manual cover face ...) )

1, the simple start. -"The only way to learn a new programming language is to use it to program"

Don't think too much, just tap the code:

[Email protected]:~/  labs#[email protected]:  ~/labs# Cat # !/bin/  Bash# # DONT THINK, todo! # Clear Echo " This is my first script. "

The above code should be very "as the name implies", try to execute this script:

[Email protected]:~/labs# SH Myfirstthis is my first script.
2.#!/bin/bashIs it necessary?

This is not a problem with most Linux systems, because the default shell for Linux users is bash, and the script runs with the user's default shell to explain the script (if #!/bin/bash does not write), but many Unix systems may use Bourne sh ell, CSH, or Ksh, as the user's default shell, if the script contains code that matches the bash syntax and makes the other shell impossible to interpret, then it must be written on the first line (and, of course, Bash is installed on the system) to keep the script running properly. --by Minsic (2009)

3, in order to ensure that the script can run smoothly! ——chmod 755 Your-script-name

Linux in various types of files are very privileged, this permission is a bit cumbersome, and change the permissions of the method is particularly many, but, for the moment, I think the title of the article is good:
(It will soon be forgotten anyway, don't ask me why.) )

[Email protected]:~/labs# chmod 755 [email protected]: ~/labs# ls --rwxr-xr-x1 root root     7 Oct  myfirst:

This command allows the computer to change the permissions of the Myfirst to: not writable except me! (Can see, can execute, just can't write!) "I" is who invites themselves to think ~

Then two black and white words are related, temporarily leave an impression on OK.

30 minutes per day.

Next section: Variables

"LINUX SHELL" Note 01: Don't think, do it!

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.