Files
mercury/scripts/vpath_find
Fergus Henderson 6ae8cc3408 Add a new script for use by the Makefile.
scripts/vpath_find:
	Add a new script for use by the Makefile.
1995-02-26 14:17:40 +00:00

23 lines
357 B
Bash
Executable File

#!/bin/sh
#
# vpath_find:
# Find the correct location for files based on the VPATH environment
# variable.
#
# Usage: vpath_find <files>...
#
VPATHS="`echo "$VPATH" | sed 's/:/ /'`"
for file in "$@"; do
for dir in "" $VPATHS; do
if [ "$dir" = "" ]; then
f="$file"
else
f="$dir/$file"
fi
if [ -f $f ]; then
echo $f
break
fi
done
done