#!/bin/bash
#<pre><b>
# Script     : mynewprogs
# Version    : 1.0
# Author     : Roland Rashleigh-Berry
# Date       : 24-Nov-2004
# Purpose    : To list all user-owned .sas files created or updated
#              since the last "timestamp" command was issued.
# SubScripts : antigrep
# Notes      : Assumes the script "timestamp" has been run to create a time-
#              stamped file in the home directory named timestamp.tmp . Only
#              files created or updated after the time stamp will be listed. 
# Usage      : mynewprogs
#              cp $(mynewprogs) /new/dir
#===============================================================================
# PARAMETERS:
#-pos- -------------------------------description-------------------------------
# N/A  
#===============================================================================
# AMENDMENT HISTORY:
# init --date-- mod-id ----------------------description------------------------
# 
#===============================================================================
# This is public domain software. No guarantee as to suitability or accuracy is
# given or implied. User uses this code entirely at their own risk.
#===============================================================================

if [ ! -f $HOME/timestamp.tmp ] ; then
  echo "Error: (mynewprogs) You have to run the \"timestamp\" script before using this" 1>&2
  exit 1
fi

iam=$(whoami)

lines=$(find . -newer $HOME/timestamp.tmp -name '*.sas' -user $iam | sed
's%^\./%%' | grep -v '/' | wc -l)

if [ $lines -eq 0 ] ; then
  echo "no new or updated .sas files have been created since the last timestamp" 1>&2
  exit 0
fi

antigrep '^/ Author       : Automatically generated by the "crtitlesds" script'
$(find . -newer $HOME/timestamp.tmp -name '*.sas' -user $iam | sed 's%^\./%%' |
grep -v '/' | sed 's/^.*: //')
