Open main menu

CDOT Wiki β

Changes

OPS245 Scripting Exercises dev

18 bytes added, 14:13, 14 January 2023
Terminal vs script file
== Terminal vs script file ==
A shell script is nothing more than a sequence of shell commands. Any command you put in a shell script can be executed just as well in a terminal. In fact no matter how complex your script is - you can run the entire thing from a terminal window without executing the script. Some of the earliest scripts people learn to create are the commands in the same sequence they would issue them from the command line, only in a script with the appropriate shebang line at the top. You learned about shebang lines in ULI101. The shebang line is the path to the interpreter, and must be the first line of your script. The '''Bash''' shebang line is ''':<pre>#!/bin/bash'''. </pre> The '''Python 3''' shebang line is ''':<pre>#!/usr/bin/env python3'''. The shebang line is the path to the interpreter, and must be the first line of your script.</pre>
== Runnning scripts ==