How do I make a bash script executable?

How do I make a bash script executable?
Answer
These are some of the pre-requisites of using directly the script name:
  • Add the she-bang {#!/bin/bash) line at the very top.
  • Using chmod u+x scriptname make the script executable. (where scriptname is the name of your script)
  • Place the script under /usr/local/bin folder.
  • Run the script using just the name of the script.
 

Tìm kiếm

Back
Top