Writing shell programs on Linux and executing __linux

Source: Internet
Author: User
Tags chmod save file
to write a shell program in Linux and perform the steps Brief Introduction

I am the first time to write a blog, do not know what should be the format and precautions, please advise.

Today is about how to create a script and run it in a Linux command-line environment.

This is not a matter for a person with a little experience, but it may be a bit of a hassle for a novice who first touches Linux, so I'll talk about it today. Enter Vim Editor, write code VI Editor is all Linux/unix operating system Standard editor, is also the current Linux system most basic text editor, the main work in the character mode, because does not need the graphical interface support, therefore it is very high efficiency. How to enter Vim. Enter the vim filename on the command line

For example, I would like to create a HelloWorld file to enter

vim HelloWorld

Enter the edit mode after entering the carriage. The following figure is the editing mode



But now you can't enter directly, to click I on the keyboard , Note that the lower left corner of the filename into the INSERT, this can start, knock code, as shown



save file, launch edit

How to save the file exit it. Press ESC first, then colon, then enter Wq, return, as shown



execute execution with a command bash filename, in this case the bash HelloWorld execution results as shown


If you want to use

./helloworld

This way, you need to give the user permission to execute, as follows

chmod u+x HelloWorld

The chmod command can modify access rights to directories and files, U represents the owner of the file, + represents the following permissions, and x represents executable permissions, as shown in


Here, the whole process is explained.

The first time to write a blog, spent one hours, later will write a better article, please support a lot.



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.