How do I execute a bash script in Terminal?

后端 未结 9 2087
無奈伤痛
無奈伤痛 2020-12-12 11:50

I have a bash script like:

#!/bin/bash

echo Hello world!

How do I execute this in Terminal?

9条回答
  •  孤城傲影
    2020-12-12 12:22

    Firstly you have to make it executable using: chmod +x name_of_your_file_script.

    After you made it executable, you can run it using ./same_name_of_your_file_script

提交回复
热议问题