#!/usr/local/bin/bash ## ## This script is for local (cs.vu.nl) use only : the script ## creates a number of subdirectories in directory $HOME/dlp ## and copies a limited number of files from the pre-installed ## /home/dejavu/dlp hierarchy : ## ## /home/user/dlp/ ## dlp1r18K/ ## bin/ ## dlp ## dlpc ## classes/ ## dlpsys.jar ## examples/ ## setvars.j122 ## declare -r -x TOOL=`basename $0` declare -r -x DST_DIR=$HOME/dlp/dlp1r18K declare -r -x SRC_DIR=/home/dejavu/dlp/dlp1r18K function mesg { echo $TOOL: $* } function home_dir { if [ -z "$HOME" ] then mesg HOME environment variable not defined exit 1 fi if [ -d $HOME ] then mesg home directory : $HOME else mesg invalid HOME environment variable exit 1 fi } function make_dir { if [ -d $1 ] then mesg "directory $1 exists" else mesg "creating directory $1" mkdir $1 fi } function copy_dir { mesg "cp -r $SRC_DIR/$1/* $DST_DIR/$1/" cp -r $SRC_DIR/$1/* $DST_DIR/$1/ } function from_dir { mesg "cp -i $SRC_DIR/$1/$2 $DST_DIR/$1/" cp -i $SRC_DIR/$1/$2 $DST_DIR/$1/ } home_dir make_dir $HOME/dlp make_dir $HOME/dlp/dlp1r18K make_dir $HOME/dlp/dlp1r18K/bin make_dir $HOME/dlp/dlp1r18K/classes make_dir $HOME/dlp/dlp1r18K/examples from_dir bin dlp from_dir bin dlpc from_dir classes dlpsys.jar from_dir examples setvars.j122