notes/IT/Scripting.md

9 lines
574 B
Markdown
Raw Normal View History

2024-05-30 18:01:43 +00:00
## Marking a script as executable
2024-05-30 18:02:43 +00:00
Sometimes, you may need to mark a script as an executable to run it. On Linux, this can be accomplished by `chmod +x [FILE]`, where `[FILE]` is the file you want to mark as executable. To unmark a file as executable, use `chmod -x`
2024-05-30 18:01:43 +00:00
2024-05-30 18:02:43 +00:00
## The shebang
There are various shells with their own language syntax (`sh`, `bash`, `fish`, etc). Therefore, more complicated scripts will indicate a particular shell by specifying the absolute path to the interpreter as the first line, prefixed by `#!` like this:
2024-05-30 18:00:43 +00:00
```sh
#!/bin/sh
echo "Hello, World!"
```