Open main menu

CDOT Wiki β

Changes

OPS245 Scripting Exercises dev

691 bytes added, 22:24, 10 January 2023
no edit summary
= Things on this page What is scripting? == Why write a script? == Scripting is an essential skill for system administrators. A good system administrator (or sysadmin) is a lazy one. They write scripts to automate repetitive tasks such as creating users or backing up files/systems.
== 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 '''Bash''' shebang line is '''#!/bin/bash'''. The '''Python 3''' shebang line is '''#!/usr/bin/env python3'''. The shebang line is the path to the interpreter, and must be the first line of your script.
== Runnning a command ==