#!/bin/sh # # finder [Linux edition v0.2] # # find uses 'find' to find stuff, either via a simple # interactive session, or via command-line parameters, # or both. # # Usage: # # interactive: # # finder # # command-line: # # finder <string>{what to find} [<s|f>{screen/file output] # # As well as big scrolls of permission errors, running as root # also prevents non-root users from using it, obviously. # # I think I originally wrote this because I kept back-to-fronting # the syntax for 'find', and when you want to find something, you # want it NOW. I often find it handy. # # (or @ corz.org 2005-> ;o) #
findwhat="$1" output="$2"
clear
echo echo " [01;32mfinder[00m [01;33mfinds stuff for you[00m" echo " [01;41mfor when the usual methods have failed![00m" echo if [ "$UID" != "0" ]; then echo " [01;31mTo avoid permission problems, finder runs as root." echo " Please enter your admin password when prompted.[00m" echo fi echo " [01;32mhints:[00m [01;33mYou can use[00m [01;32mwhereis[00m[01;33m to quickly find applications and[00m [01;32mlocate[00m" echo " [01;33mto find files that are in the locate database (older than a day).[00m" echo echo " [01;32mnotes:[00m [01;33mConnected shares will NOT searched.[00m" echo
if [ -z "$findwhat" ]; then
echo " [01;36mEnter the name of the file or folder to find..[00m[01;35m" echo " [01;32mhint:[00m [01;33myou can use wildcards like..[00m *.ttf" echo read findwhat fi
if [ -z "$findwhat" ]; then echo "[01;32m If nothingness is what you seek, look elsewhere![00m" echo exit 1 fi echo echo "[01;32m searching for:[00m [01;33m$findwhat[00m" echo
if [ -z "$output" ]; then
echo " [00m[01;36mwould you like the output to screen or file? [s/f][00m" echo " [01;32mhint:[00m [01;33myou can simply hit <enter> to output to screen[00m" echo read output echo fi echo " [01;32mlooking for [01;35m$findwhat[00m[00m".. echo " [01;32mhint:[00m [01;33mpress CTRL+C to terminate the find[00m" echo