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.