Overview
Comment:Now handles library name
Returns a status
0 if exactly one result
1 if no results
2 if two or more results
3 if utterly confused
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: e4ee38f6923ab7bbd7f7ce1d394be5e7ee4b2aab7f124370c84253c6b7c8261f
User & Date: gawthrop@users.sourceforge.net on 1998-07-17 07:50:33.000
Other Links: branch diff | manifest | tags
Context
1998-07-17
08:27:33
Added find target check-in: 3f2a5e3d2b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
07:50:33
Now handles library name
Returns a status
0 if exactly one result
1 if no results
2 if two or more results
3 if utterly confused
check-in: e4ee38f692 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1998-07-16
20:41:05
Now uses new mtt_help check-in: cc231eb983 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
︙︙
10
11
12
13
14
15
16



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31


32


33
34


35
36
37
38
39


40
41
42
43
44
45

46
47
48
49
50
51
52
53
54
55

56
57













58
59
60
61
62
# Copyright (c) P.J.Gawthrop 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.3  1998/07/16 09:15:34  peterg
## Now prints:
## 	dir
## 	name_lbl.txt
##         access time
##
## 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"






if [ -n "$2" ]; then


    name="-name $2"
fi
q=\




paths=`echo $path | tr ":" " "`
foundpath=`\
for thepath in $paths; do
    find $thepath -type d  $name -print 
done | \
sort -u`


# 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
 for thepath in $foundpath ;  do
  dirname=`echo $thepath | awk -F/ '{print $NF}'`
  fullname="$dirname"_lbl.txt
  find $thepath -maxdepth 1 -name $fullname  -printf '%h\t%f\t%Ac\n';
 done

fi


























>
>
>














|
>
>

>
>


>
>
|

<


>
>



|
|
|
>









|
>


>
>
>
>
>
>
>
>
>
>
>
>
>





10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Copyright (c) P.J.Gawthrop 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1998/07/16 20:40:24  peterg
## Cleaned up algorithms
##
## Revision 1.3  1998/07/16 09:15:34  peterg
## Now prints:
## 	dir
## 	name_lbl.txt
##         access time
##
## 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
##
###############################################################

# Set up dummy file
rm -f mtt_junk
touch mtt_junk

# Interpret the arguments
path="$1"

if [ -n "$2" ]; then
    name=`basename $2`
    longname=$2
    Name="-name $name"
fi



# Find all dirs in path with same name as component
# AND the path contains the full (name+library) name
paths=`echo $path | tr ":" " "`
foundpath=`\
for thepath in $paths; do
    find $thepath -type d  $Name -print 
done |\
sort -u |\
grep "$longname"`

# 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
 for thepath in $foundpath ;  do
  dirname=`echo $thepath | awk -F/ '{print $NF}'`
  fullname="$dirname"_lbl.txt
  find $thepath -maxdepth 1 -name $fullname  -printf '%h\t%f\t%Ac\n';
 done |\
 tee mtt_junk
fi

# Check exit status and return 
hits=`wc mtt_junk | awk '{print $1}'`
rm -f mtt_junk

if [ $hits = "1" ]; then
    exit 0
elif [ $hits = "0" ]; then
    exit 1
elif [ $hits > "1" ]; then
    exit 2
else
    exit 3
fi






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