corz.org uses cookies to remember that you've seen this notice explaining that corz.org uses cookies, okay!
corz.org text viewer..
[currently viewing: / public/ linux/ usr/ local/ bin/ finder.sh - raw]
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
case $output in
f)
echo " [01;32msending results to[00m [01;35m~/finder.log[00m"
echo "" > ~/finder.log
echo
echo "finder." `date` >> ~/finder.log
echo "results for \"$findwhat\".." >> ~/finder.log
echo "" >> ~/finder.log
sudo find / -name "$findwhat" -xdev >> ~/finder.log
;;
*)
echo "[01;32m"
sudo find / -xdev -name "$findwhat"
echo "[00m"
;;
esac
echo
echo "[01;32mfind complete![00m"
echo
Welcome to corz.org!
Since switching hosts (I hope you are alright, Ed! Wherever you are …) quite a few things seems to be wonky.
Juggling two energetic boys (of very different ages) on Coronavirus lockdown, I'm unlikely to have them all fixed any time soon. Mail me! to prioritise!