Android and Linux

Thursday, May 20, 2010

Whereis redux

I made my little whereis script a little better and uploaded it to the Android app L.E.S. Linux.

L.E.S. Linux is a cool little app which allows you to download Linux executables, scripts and libraries which have been compiled or made for Android. I will probably put any scripts which I think may be useful on L.E.S. The only other one I have in mind so far is the little "locate" script which I'll upload after I make it a little more presentable.

Here is the whereis script I uploaded. I named it whereis.sh to avoid confusion with the real (but missing on Android) whereis executable but, oops, I accidentally called it "whereis" instead of "whereis.sh" in the actual script. Oh well.

#! /system/bin/sh

if test -z "$1"
then
echo "whereis.sh by fubaya (a-more-common-hades.blogspot.com)
This is a cheap imitation of the UNIX whereis command.
It doesn't imitate all the whereis functions, it only looks in your
path for the binary (or other file) which you specify as an argument.

USAGE: whereis [arg]
EXAMPLE:
$ whereis date
/system/bin/date
/system/xbin/date
$"
else
echo $PATH | tr ':' '\n' | while read line; do ls "${line}/${1}" 2>/dev/null; done
fi


Copy whereis.sh to your clipboard with this QR code:

Followers