ERODD HOME

Operating Systems CPSC 304
Earl Rodd erodd@malone.edu Extension 8546 www.malone.edu/erodd
Shell from Program Lab

Overview

In this lab, we will write a programs which will execute operating system commands. We will do a program in C++ and one in Java. Programs may be written in Windows or in Linux.

C++

Java

Hint: If the command has parameters (e.g. ps -ef in LINUX), you can pass this as 1 String, not 2, to the java program by putting it in quotes like this:
java cmdiii 'ps -ef'

Hint: The 'ps -ef' command in LINUX will return a number of lines which start with 'square'. Windows does not have this command so you will need to figure out a way to test your count of lines which start with a particular String.

To Turn In

  1. Printouts of both programs.
  2. Copy both programs to the instructor drive: Windows: copy cmdiii.c R:\ERODD\STUDENTS copy cmdiii.java R:\ERODD\STUDENTS Linux: cp cmdiii.c /home/square/tdrive/erodd/students cp cmdiii.java /home/square/tdrive/erodd/students