423ba10303
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
25 lines
395 B
Bash
25 lines
395 B
Bash
#!/bin/sh
|
|
# Nico Schottelius
|
|
# cinit: find binary in path
|
|
# Date: 2005-10-15
|
|
#
|
|
|
|
set -e
|
|
|
|
if [ $# -ne 1 ]; then
|
|
echo "$(basename $0): searched binary"
|
|
exit 1
|
|
fi
|
|
|
|
binary=$1
|
|
|
|
# this is NOT really clean, paths can also contain spaces
|
|
for pfad in $(echo $PATH | sed 's/:/ /g'); do
|
|
fullname=$pfad/$binary
|
|
if [ -f "$fullname" ]; then
|
|
echo "$fullname"
|
|
exit 0
|
|
fi
|
|
done
|
|
|
|
exit 1
|