Introduction . CIT 383: Administrative Scripting. About Me http://www.nku.edu/~waldenj1. James Walden Assistant Professor of Computer Science [email protected] Experience: System administration (CMU, Intel, UT, NKU) Operating systems: VMS, UNIX, Linux, IOS
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
A successful student should be able to
1. Read and understand programs written in the ruby language.
2. Construct portable, secure programs in ruby.
3. Automate common system administration tasks.
4. Write networking scripts that interact with e-mail, web, and directory servers.
5. Write programs to parse common data formats such as CSV, XML, and YAML.
Spend 12-18 hours a week outside of class.
Do every lab
Do every assignment
Prepare for tests at least a week beforehand
Don’t use equality tests for floats
0.4 – 0.3 == 0.1 is false
Check if difference is sufficiently small
(0.4 – 0.3) – 0.1 < 1.0e-9 is true
Variables allow us to name values
x = 1.0 # Assigns the value 1.0 to x
x # A variable reference, evals to 1.0
Create strings using single quotes.
Escape ‘ using \
If your string has a lot of ‘ or “ in it, you have to do a lot of escaping so ...
Ruby allows you to choose your own quotes
Use double index to access substrings
x = “Hello”
x[0,2] == “He”
x[-2,2] == “lo”
x[0,0] == “” # For all strings
x[0,10] == “Hello”
x[0,-1] == nil # Negative lens ret nil
Modify string by assigning to index
x[0,2] = “Ma”
x[-2,2] = “ow”
x == “Mallow”
x[2,2] = “”
x == “Maow”
Method calls in ruby use the dot syntax:
If the object is not specified, the method is invoked on the default object self.