vesik n00b
Joined: 16 Sep 2002 Posts: 14
|
Posted: Thu Dec 12, 2002 10:24 pm Post subject: [Bash Script] - POO (Port of Origin) aka fun with qpkg! |
|
|
hello all,
just thought i would post this ugly little script that i was toying with. it just uses qpkg to locate the package that the input file(s) came from. lol. i'm such a geek, i was as giddy as a school girl watching it chug through my /usr/bin. *cough* yes, i do see the sun sometimes!
Code: |
poo() {
local FILEPATH
echo
echo -e " \E[1m\E[32mChecking Port of Origin\E[0m"
for filename in $@
do
FILEPATH=""
if [ -d ${filename} ]; then continue; fi
if [ -e ${PWD}/${filename} ] && [ -f ${PWD}/${filename} ]
then
FILEPATH="${PWD}/${filename}"
elif [ -e ${filename#${PWD}/} ] && [ -f ${filename#${PWD}/} ]
then
FILEPATH=${filename}
elif [ -n "$(which ${filename} 2>/dev/null)" ]
then
FILEPATH=$(which ${filename} 2>/dev/null)
else
echo -e " \E[34m*\E[1m \E[31m${filename} not found!\E[34m*\E[1m\E[0m"
fi
if [ -n "${FILEPATH}" ]
then
echo -ne " \E[34m|\E[0m \E[33m$(basename "${filename}")"
echo -ne "\E[34m|\E[1m\E[31m <--- \E[0m"
echo "$(qpkg -f "${FILEPATH}")"
echo -ne " \E[34m[ \E[35m${FILEPATH}\E[0m \E[34m]\E[35m "
echo -e "$(ls -lh ${FILEPATH} | \
awk '{ print $3 ":" $4 "\t" $1 "\t" $6 " " $7 " " $8 }')\E[0m"
fi
done
echo
}
|
-vesik
ps. stick it in your .bashrc[/code] |
|