How do I run a bash file in Linux?

thanhthao

New member
How do I run a bash file in Linux?
Answer
The procedure is as follows:
  1. Create a new file called demo.sh using a text editor such as nano or vi in Linux: nano demo.sh.
  2. Add the following code: #!/bin/bash. echo “Hello World”
  3. Set the script executable permission by running chmod command in Linux: chmod +x demo.sh.
  4. Execute a shell script in Linux: ./demo.sh.
19 дек. 2018 г.
 

Tìm kiếm

Back
Top