mirror of https://github.com/CGAL/cgal
73 lines
1.4 KiB
Bash
Executable File
73 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# ============================================================================
|
|
# Copyright (c) 2005 INRIA (France).
|
|
# All rights reserved.
|
|
#
|
|
# This file is part of CGAL (www.cgal.org); you may redistribute it under
|
|
# the terms of the Q Public License version 1.0.
|
|
# See the file LICENSE.QPL distributed with CGAL.
|
|
#
|
|
# Licensees holding a valid commercial license may use this file in
|
|
# accordance with the commercial license agreement provided with the software.
|
|
#
|
|
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
#
|
|
# $URL$
|
|
# $Id$
|
|
#
|
|
#
|
|
# Author(s): Laurent Saboret, Pierre Alliez, Bruno Levy
|
|
# Purpose: Search for the first file/folder existing in a list
|
|
# ============================================================================
|
|
|
|
#
|
|
# Usage
|
|
# ------
|
|
usage ()
|
|
{
|
|
echo "\
|
|
Search for the first file/folder existing in a list. Print an empty string on failure.
|
|
Usage: $0 file1 file2..."
|
|
|
|
exit 1
|
|
}
|
|
|
|
#
|
|
# Test arguments
|
|
# --------------
|
|
if [ ! "$1" ] # If no argument
|
|
then
|
|
usage
|
|
fi
|
|
|
|
for arg in $* # Parse arguments
|
|
do
|
|
case "$arg" in
|
|
-*) usage # if unknown option
|
|
;;
|
|
* ) # ok if file/folder name
|
|
;;
|
|
esac
|
|
done
|
|
|
|
#
|
|
# Test each file
|
|
# ---------------------
|
|
for file in $*
|
|
do
|
|
if [ -e "$file" ]
|
|
then
|
|
echo "$file"
|
|
exit 0
|
|
fi
|
|
done
|
|
|
|
#
|
|
# Print an empty string on failure
|
|
#-----------------------------------
|
|
echo ""
|
|
exit 1
|
|
|