Open main menu

CDOT Wiki β

Changes

no edit summary
== Lab 1:==
::'''Scripting for Lab1'''. Lab 1 could be modified to have students generate a report regarding the collection of Linux information after an install. Certainly '''command substitution''' could be taught and to reinforce '''redirection''' >> to add content to a filename (i.e. not over-ride). It would be interesting to expose students to the '''zenity''' command to allow a menu to give user choice of report elements to include in the generated report. Perhaps a link to a "fancy" Bash shell script to generate a web-page so students can view the contents in a nice format. This scripting element could easily be added to assignment #1.<br><br>It is recommended to add to lab1 a simple '''step-by-step procedure to generate a simple text-based report in a shell script''' (eg. '''text-report.bash'''), but also have students use '''wget''' command to download, set execute permissions and run more sophisticated shell scripts (eg. '''report.bash''' and '''report2.bash''')
{|cellpadding="15" width="100%"
|-
|<blockquote><blockquote>'''Example of simple text-based report shell script Demo (teach at end of lab1):<br>''' [ [https://scs.senecac.on.ca/~murray.saul/text-report.bash text-report.bash] ]<br><br>'''Scripting Skills:'''<blockquote><ul><li>'''if''' statement</li><li>'''exit''' command</li><li>USER '''Environment Variable'''</li><li>'''redirection''' (both &gt; and &gt;&gt;)</li><li>'''command substitution'''</li></ul></blockquote>'''Practical Consideration for scripting in lab1:'''<br><blockquote> Students create simple bash shell script, add elements, then have them copy and paste, then run this script. Key elements related to the script is evaluated and provides basis for other scripting tasks in other labs? Should midterm and/or final exam contain a scripting question? (recommended)<br><br></blockquote></blockquote>
|[[Image:lab1-script-text-report.png|thumb|left|400px|When executed as '''root''' or using '''sudo''' command, script generates a basic text-based report in a file]]
|}
{|cellpadding="15" width="100%"
|-
|<blockquote><blockquote>'''Example of a graphical shell script Demo:<br>''' [ [https://scs.senecac.on.ca/~murray.saul/report.bash report.bash] ]<br><br>'''Scripting Skills:'''<blockquote><ul><li>'''if''' statement</li><li>'''exit''' command</li><li>USER '''Environment Variable'''</li><li>'''redirection''' (both &gt; and &gt;&gt;)</li><li>'''zenity'''</li><li>'''for''' loop</li><li>'''command substitution'''</li><li>'''sed'''</li><li>'''set''' command ('''positional parameters''')</li></ul></blockquote><br><br>'''Practical Consideration for scripting in lab1:<br><blockquote>''' Students use '''wget''' to download existing shell script and run it to see what happens. Students are '''encouraged to view contents of more advanced shell script(s)''', to see where the commands are being used (from previous shell script), but are '''not required to understand more complex elements''' of these shell scripts.<br><br></blockquote></blockquote>
|[[Image:lab1-script-1.png|thumb|left|175px|When executed as '''root''' or using '''sudo''' command, provides VM status and opportunity to '''start''' VMs]]
|[[Image:lab1-script-2.png|thumb|left|175px|When executed as '''root''' or using '''sudo''' command, provides VM status and opportunity to stop '''running''' VMs]]
13,420
edits