-
Senior Member
registered user
what_makes script (like: whereis)
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:
Code:
#/bin/bash
# (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"
exit
fi
PROG=$1
LOCATION=$(which $PROG)
# not needed, 'file' shows it as well: echo $LOCATION
file $LOCATION
ART=$(file $LOCATION | grep -c text)
if [[ ART -eq 1 ]]; then
cat $LOCATION
fi
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...
Similar Threads
-
By monkeyking in forum MS Windows & New to Linux
Replies: 1
Last Post: 01-03-2005, 10:19 PM
-
By A. Jorge Garcia in forum Hdd Install / Debian / Apt
Replies: 10
Last Post: 11-20-2004, 02:18 AM
-
By XX in forum General Support
Replies: 3
Last Post: 01-25-2004, 06:54 PM
-
By lindros in forum General Support
Replies: 10
Last Post: 07-24-2003, 08:26 PM
-
By punk000 in forum General Support
Replies: 3
Last Post: 02-26-2003, 07:02 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Intel Core i7-6700 3.4 GHz CPU Processor (SR2L3)
$64.99
Intel Core i5-8500 Six Core Desktop PC CPU Processor 3.00GHz LGA1151 SR3XE
$49.99
Intel - Core i9-14900K 14th Gen 24-Core 32-Thread - 4.4GHz (6.0GHz Turbo) Soc...
$544.99
AMD Ryzen 9 7900X3D Gaming Processor - 12 Core And 24 Threads - 5.60 GHz Max Boo
$329.99
AMD Ryzen 5 4500 6-Core 3.6GHz Socket AM4 65W CPU Desktop Processor
$77.77
Intel Core i7-7700 Kaby Lake Quad-Core 3.6 GHz Processor LGA 1151
$77.99
AMD Ryzen 5 2600 - 3.9 GHz Six Core (YD2600BBM6IAF) Processor
$49.00
Intel Xeon E5-2697 V4 2.30GHz CPU Processor SR2JV
$44.95
Intel Xeon E5-2673 v4 20-Core 2.30GHz 50MB 9.60GT/s 135W Processor SR2KE
$78.99
Intel Xeon E3-1285 V3 3.6 GHz 8M Quad-Core SR14W CPU Processor
$49.50