File mttroot/mtt/bin/mtt_find artifact ef6ca7d9c5 part of check-in c7f32f44c4


#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_find
# mtt_find path name operation
# P.J.Gawthrop Nov 1996
# Copyright (c) P.J.Gawthrop 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1997/09/04 09:15:19  peterg
## Includes summary line as well as description lines
##
## Revision 1.1  1996/11/10 10:48:45  peterg
## Initial revision
##
###############################################################

path=$1
name=$2
fullname=$2_lbl.txt
all=$3

q=\


# awk splits the path into components and writes a find for each
# If all argument null, then succesful find terminates.
foundpath=`awk 'END{ \
  n=split(path,a,":"); 
  if (all == "") { 
    printf("if ");
  }  for (i=1;i<=n;i++) { 
  printf("find %s -type d -name \"%s\"  -print \n", a[i], name);
  if (all == "") { 
    printf("then\n"); 
    printf("exit\n"); 
    printf("fi\n");
  }
   }
     }' path="$path" name="$name" operation="$operation" all="$all" \
</dev/null  | sh`

# If non-null result, check that the name_lbl.txt file exists in dir name
# and print dirname and file name and last access time

if [ -n "$foundpath" ]; then
  find $foundpath -maxdepth 1 -name $fullname  -printf '%h\t%f\t%Ac\n' | sort -u
fi








MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]