initial commit
This commit is contained in:
commit
7ea011f13c
28
which
Executable file
28
which
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Copyright (c) 2023 Emma Tebibyte
|
||||||
|
# SPDX-License-Identifier: FSFAP
|
||||||
|
#
|
||||||
|
# Copying and distribution of this file, with or without modification, are
|
||||||
|
# permitted in any medium without royalty provided the copyright notice and this
|
||||||
|
# notice are preserved. This file is offered as-is, without any warranty.
|
||||||
|
|
||||||
|
argv0="$0"
|
||||||
|
|
||||||
|
if test -z "$1"; then
|
||||||
|
printf "Usage: %s command...\n" "$0" 1>&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
while test -n "$1"; do
|
||||||
|
out="$(command -V "$1")"
|
||||||
|
location="$(printf "%s\n" "$out" | sed -n 's/.\+ .\+ //p')"
|
||||||
|
|
||||||
|
if [ "$location" = "found" ]; then
|
||||||
|
printf "%s: %s.\n" "$argv0" "$out" 1>&2
|
||||||
|
exit 69 # sysexits(3) EX_UNAVAILABLE
|
||||||
|
else
|
||||||
|
printf "%s\n" "$location"
|
||||||
|
fi
|
||||||
|
|
||||||
|
shift
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user