How do I run a script in Linux?

How do I run a script in Linux?
Answer
Steps to write and execute a script
  1. Open the terminal. Go to the directory where you want to create your script.
  2. Create a file with .sh extension.
  3. Write the script in the file using an editor.
  4. Make the script executable with command chmod +x <fileName>.
  5. Run the script using ./<fileName>.
Photo in the article by “Wikimedia Commons”
Code:
https://commons.wikimedia.org/wiki/File:OpenBSD_vi_Editor_Ruby_Hello_World.png
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.
 

Tìm kiếm

Back
Top