Nguyễn Trường Sinh
Member
How do I run a script in Linux?
Answer
Steps to write and execute a script
The best way to learn is practice.
Take a few minutes to try Vim out.
If you’re on a Linux system right now, open up a terminal and type vim filename.
Enter insert mode and type a bit (or copy some of the text from this article into Vim) and then hit Escape to start practicing movement around the file.
Answer
Steps to write and execute a script
- Open the terminal. Go to the directory where you want to create your script.
- Create a file with .sh extension.
- Write the script in the file using an editor.
- Make the script executable with command chmod +x <fileName>.
- Run the script using ./<fileName>.
Code:
https://commons.wikimedia.org/wiki/File:OpenBSD_vi_Editor_Ruby_Hello_World.png
Take a few minutes to try Vim out.
If you’re on a Linux system right now, open up a terminal and type vim filename.
Enter insert mode and type a bit (or copy some of the text from this article into Vim) and then hit Escape to start practicing movement around the file.