-
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

Cisco ASR 9001 Router 4x 10G SFP+ 20x 1G SFP 2x PSU | ASR-9001, A9K-MPA-20X1GE
$1200.00

Cisco Catalyst WS-C2960+24TC-S 24-Port Gigabit Managed SFP Switch
$39.99

Cisco Catalyst C9130AXI-B WiFi 6 802.11ax Wireless Access Point Brand New
$101.99

Cisco Catalyst 2960-48TT-L 48-Port Fast Ethernet Managed Rackmount Switch
$46.99

Cisco C3850-NM-2-10G 2 Port Network Exp.Module for 3850
$18.90

Cisco C9300-NM-2Y - Cisco Catalyst 9300 2 x 25G Network Module New
$550.00

Cisco C9500-32QC-A C9500 Series 32x Port 40G or 16x 100G - Dual AC
$1099.00

Lot of 100 Genuine Cisco 10-3105-01 SFP-10G-SR-S Transceiver w/ Hologram
$320.90

Cisco Acacia DP04QSDD-E25-840 400G QSFP-DD Coherent DCO Transceiver Module
$699.99

nxa-pac-750w-pe v02 NEW OPEN BOX for Cisco Nexus 9300 Series power supply
$200.00