View Full Version : what_makes script (like: whereis)

user unknown
05-09-2004, 06:15 AM
I'm often uncertain, whether a program is a script, or a binary.
And where is it installed?
So I wrote a script, which looks
which command would be used (/usr/bin/foo /usr/local/bin/foo ?)
what kind of file it is (script, elf-binary?)
and if it is a script, it is printed to stdout.

Since I made it (and made some improvements) I'm using it quiete often, so perhaps it's useful for others too:

It's GPL:

# (c) 2003 bashguru Stefan Wagner, Berlin Schöneberg, license: GPL
# For a programm:
# find where it is (especially if there is more than one):
# <which>
# what kind of hack is this (elf-binary, bash-script?):
# <file>
# if it is a script, print it:
# <cat>
if [[ $# -ne 1 ]]; then
echo "Usage: whatmakes.sh THIS"
# not needed, 'file' shows it as well: echo $LOCATION
ART=$(file $LOCATION | grep -c text)
if [[ ART -eq 1 ]]; then

Don't miss the final empty line :)
Put it into ~/bin or /usr/local/bin to have it easy accessible in your path.

Feedback is welcome.
manpage and option --help should be made... I know...