-
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

Samsung 256GB SSD MZ-JPV256S/0A2 PCIe Solid State Drive SSD SSUBX 655-1959A
$22.02

Samsung Galaxy Tab A11+ 5G 11in 6GB RAM 128GB Wi-Fi+5G Gray
$199.99

Samsung Galaxy Tab S10+ 5G (256GB, 12GB, Wi-Fi + Cellular, Unlocked) 12.4" X828U
$579.99

Samsung T7 Shield 1TB Portable External SSD USB 3.2 Black MU-PE1T0S NEW SEALED
$219.99

RAM-GDS-SKIN-SAM80-NG RAM IntelliSkin® Next Gen for Samsung Tab A7 Lite 8.7”
$82.99

RAM-GDS-DOCK-SAM80CPU RAM GDS® Tough-Dock™ for Samsung Tab A7 Lite 8.7"
$159.49

3 -M.2 2280 512GB SSD - Samsung MZNTE512HMJH, MZNLN512HMJP, Toshiba KSG60ZMV512G
$155.00

1 lot of 3 (2)Samsung PM951 SM961 & (1)Intel SSD 600P 256GB M.2 2280 SSD NVMe
$109.00

Samsung Galaxy Tab Active 3 / 64 gig/ WIFI/ IP68 Rated
$85.00

Samsung Galaxy View Tablet 18.4 SM-T670/677A Digitizer 100% Original Oem
$152.99