-
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

Atari 800XL Home Computer Unit Only - UNTESTED, For Parts or Repairs
$94.97

ATARI 800 XL 8-Bit Computer w/ Power Supply
$169.00

DEFECTIVE Atari 810 Vintage Computer Disk Drive powers on Unit Only Boo G3D
$55.24

UNOCART-2600 SD card Multi Rom Cartridge for ATARI 2600 with CASE
$34.25

Atari 800 Home Computer System 800 Untested
$95.00

Vintage Atari 520ST Computer Untested No Power Supply
$150.00

Fujinet 1.7.1 Atari 400 800 800XL 130XE 65XE XEGS Assembled, Tested, Working
$99.99

VTG Atari 800XL Home Computer Retro System Console Untested Parts Repair Only
$119.99

Atari 1040ST Computer System SM124 Monitor Megafile 60 SLMC804 Bundle W/ Boxes
$849.00

Atari 400 Computer System console with Power Supply TESTED and Working
$160.00