The Execution Permission#
The most common thing you'll find yourself doing is setting a script/file to be executable, in my opinion: chmod +x script.py
. Now you can do ./script.py
and it'll (hopefully) execute.
Copy and paste the following to your terminal and we'll check the results out after the fact:
1 2 3 4 5 6 |
|
After you copy/paste this, hit Enter to trigger the line ./my_script
. I get this:
1 2 3 4 5 6 7 |
|
You just created an executable. Even though it was a plain file, it had two ingredients that made it an executable:
- It had the
x
permission - It has a "bang" line:
#!/bin/bash
We'll come to the bang line later. For now, the x
permission is what interests us.
We know what it means, but I wanted you to create a script and see it in action.