Utilities for interacting with the files in the /usr/local/classes/MCX1/jaye and /MCX2/jaye

MCX1 home    MCX2 home   Using FTP

Many of the files that you will need in the course will be stored in the /usr/local/classes/MCX1/jaye directory or the /usr/local/classes/MCX2/jaye directory on the school's network. To interact with these directories, one can use the standard LINUX operating  system commands or the utility command files (described below) to automate the process.
Using Option A below (and working with the standard Linux commands) is the recommended approach.

OPTION A: a minimal but excellent approach, especially for poor typists
1. Carefully edit the file
.bash_profile: Add these statements after the last line:
    alias cd3='cd /usr/local/classes/MCX1/jaye'  
No spaces should appear to left or right of the equal sign!!
    alias cd4='cd /usr/local/classes/MCX2/jaye'
2. Now after every log on, entering
cd3 at the command line will switch the current or working directory to
     /usr/local/classes/MCX1/jaye and entering cd4 will switch it  to /usr/local/classes/MCX2/jaye
3.
To copy Recursion directory to your home directory
    
1. Create a directory in your home directory:  
       
mkdir Recursion  creates a directory in your home directory with the name  Recursion
    
2. Copy files from jaye/MCX2 Recursion directory to your Recursion directory:
          a.
cd4 switches you to /usr/local/classes/MCX2/jaye directory
        b.
cp Recursion/*  ~/Recursion copies all the files in jaye/Recursion directory to the Recursion
               diectory you just created in your home directory
4.
To return to your home directory, enter cd

OPTION B: (involves script files cp3/cp4, ls3/ls4, and cp3Dir/cp4Dir)
1. To copy files from /usr/local/classes/MCX2/jaye to current SHS directory (cp4)
1a. Enter this command: cp /usr/local/classes/MCX2/jaye/cp4 ~    or...
1b. Use your browser to copy all the text below to your editor and save to file name cp4 and upload
     this file to your SHS account or...
2. Usage

   1. To copy  95a1.cpp from /usr/local/classes/MCX2/jaye/Problems directory enter:
        bash cp4 Problems 95a1.cpp
   
2. To copy  ls4 from /usr/local/classes/MCX2/jaye/ directory enter:
        bash cp4  ls4

#!/bin/bash
if [ $# -eq 0 ]
then
   echo ""
   echo "USAGE: bash cp4 directoryName fileName"
   echo "EXAMPLE: bash cp4 Problems 95a1.cpp "
   echo "directoryName = Problems, fileName = 95a1.cpp"
   echo "Copies /usr/local/classes/
MCX2/jaye/Problems/95a1.cpp to current dir"
   echo ""
   echo "USAGE: bash cp4 fileName"
   echo "EXAMPLE: bash cp4 ls4"
   echo "Copies /usr/local/classes/
MCX2/jaye/ls4 to current directory"
   echo ""
   exit 1
fi
if [ $# -eq 1 ]
then
   cp /usr/local/classes/
MCX2/jaye/$1 $1
   exit 0
fi

if [ $# -eq 2 ]
then
   cp /usr/local/classes/MCX2/jaye/$1/$2 $2
   exit 0
fi

2. To list files in /usr/local/classes/MCX2/jaye directory (ls4)
1. Copy  ls4 from /usr/local/classes/MCX2/jaye directory
2. Usage:

   1. To list files in /usr/local/classes/MCX2/jaye/Problems directory enter:
        bash ls4 Problems
   
2. To lst  files in  /usr/local/classes/MCX2/jaye directory enter:
        bash ls4

3. To copy an entire directory from /usr/local/classes/MCX2/jaye directory (cp4Dir)
1. Copy  cp4Dir from /usr/local/classes/MCX2/jaye directory
2. Usage:

   1. To copy  /usr/local/classes/MCX2/jaye/Problems to directory Probs in current directory:
        bash cp4Dir Problems Probs  (If directory Probs doesn't exist, it will be created)
   
2. To copy files in  /usr/local/classes/MCX2/jaye/ADT to current directory enter:
        bash cp4Dir ADT

 

MCX1 home    MCX2 home