Changes

Jump to: navigation, search

OPS245 Scripting Exercises dev

726 bytes added, 01:36, 15 January 2023
Exercises
= Exercises =
These are a suggested order. You can do these exercises in any order, and change them in any way you like.* Sample (see below): Create a bash script that will print Hello, then list the contents of the / directory, then print Good Bye.'''Bash'''<pre>#!/bin/bash# Author: Jason Carman# Date: January 10, 2023# Purpose: Print hello, list the contents of /, then print goodbye# Usage: ./hello # Print hello on the screenecho "Hello" # List the contents of /ls / # Print good bye on the screenecho "Good Bye</pre> **Sample (see below): Create a python script that does the same thing.'''Python'''<pre>#!/usr/bin/env python3# Author: Jason Carman# Date: January 10, 2023# Purpose: Print hello, list the contents of /, print good bye# Usage ./hello.py# # Import the os moduleimport os # Print helloprint('Hello') # List the contents of the bin directoryos.system("ls /") # Print good byeprint('Good Bye') </pre> 
* Create a bash script that will run your other script twice.
 
* Now do it in python.
** Run this new script from different locations, and see if it always works. Fix it if it doesn't.
* Create a bash script to display the contents of /etc/sysconfig/network-scripts/ifcfg-ens33

Navigation menu