Programming practice assignment 1

The posted pdf from the first lecture lists several bash commands that are useful to know if you want to become comfortable from the command line.

By far the most important commands that we will use are:
    ls  which gives a directory listing  (in DOS this is the dir command).
    cd  which changes into a directory
    cp to copy a file
    mv to move a file -- WATCH OUT: you will NOT be warned if the command will over-write an existing file.
    mkdir which creates a new directory
    pwd to print your working directory

Recall that using > after a command in bash sends the output to a file.  So:
ls > a

would write the results of the ls command to a file called 'a'

I recommend not using the remove command (rm on Mac, del on windows) unless you are confident of you abilities from the command line.

I also posted a simple python script called that prints out command line arguments in a more verbose way than the UNIX's built in echo command (It will show up in your browser as so you'll have to rename it).

Here is the exercise to make sure that you are familiar enough with the Terminal to invoke the python programs that we'll be writing:

    1. Download the script and remember where on your hard drive that you saved it.
    2. Open a Terminal (/Applications/Utilities/Terminal on Mac) or Cmd.exe (Windows) to get a command terminal.
    3.  Invoke python and give it the script as its only argument.
    This step will require that:
        (a) you can invoke python (it must be in a directory listed in your PATH variable or you must specify the absolute file path to python). Because it is on my PATH, I can invoke python by typing:
        or by the full path:
        (If you get into python and need to get out then you can type "exit" and return.  The python interpreter will tell you the appropriate way to leave pytho on your Operating System -- it is Ctrl-D on Mac).
        (b) you can specify the path to the  When you open a new terminal you will be in your home directory, so you have to be able to specify the relative path (from your home to where is saved) or the absolute path (how to find from the root of the filesystem).
    If you don't specify the path the correctly, Python will give you an error indicating that it can't find the file.
    4. change your working to the same directory as
    5. invoke python with as an argument and "hi" as an additional argument.  (you should now be able to just use the name as the argument to python instead of a path to the script).
    6. Call with the phrase hi there in two different ways. First let each word be a different argument.  Next have pass the phrase in as a single argument (this will require quoting).
    7. Copy to the parent directory under the name (The relative path syntax for "parent directory" is ..)
    8. Invoke the copy giving it whatever arguments you like.
    9. Invoke the copy of again, and this time redirect output to a file called exercise output.txt  Open the file in a text editor and verify that it contains what you expected.
    10. Send the argument -v to
    11. Now send -v as an argument to python. To do this, the token -v has to come earlier in the command line than  How does the behavior change?