ScriptingLesson 45Free preview
Bash Script
This lesson is part of Bash · All levels
Summary
A Bash script is a text file that contains a sequence of commands running in sequence. The script is usually started with the #!/bin/bash, given execution permission, and then executed with./skrip.sh or by the bash command. The $ variable displays the final output code to check for success.
Key points
- The first line #!/bin/bash specifies the interpreter
- Chmod +x skrip.sh gives permission for the execution
- Run with./skrip.sh or bash skrip.sh
- $? contains the last output code, 0 means success
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.