CommandPrograms.com
Terms and Conditions: All content of this site is for instructional purposes only and can be used ONLY AT YOUR OWN RISK - Notice given.
home   --> to commandprograms.com home page . . .
#!/bin/bash
#Apps - shows applications in linux (tested in Debian 8.)
#(-->Check system dependent location of the .desktop directory.<--)
function Usage { echo 'USAGE: Apps [ [--desktop] | [--sh] | [] | [.]=neat | [--help] ]'; }
X=$(tput cols)
if [ "$1" == "--help" ];
then
Usage
exit
else
if [ "$1" == "." ];
then
ls ${PATH//:/ }
else
if [ "$1" == "--sh" ];
then
for filename in /usr/share/applications/*.desktop ; do
File=$(basename $filename)
C1=$(echo -e -n "$File " | cut -b-35 )
C2=$(grep -i -s "comment=" $filename | cut -d'=' -f2)
echo "$C1 $C2" | cut -b-$X
done
else
if [ "$1" == "--desktop" ];
then
for filename in /usr/share/applications/*.desktop ; do
File=$(basename $filename)
C1=$(echo -e -n "$File " | cut -b-35 )
C2=$(grep -i -s "comment=" $filename | cut -d'=' -f2)
echo "$C1 $C2" | cut -b-$X
done
else
if [ "$1" == "" ];
then
for d in ${PATH//:/ } ; do
for f in $d/* ; do
test -x $f && test -f $f && echo $f
done
done
else
ls ${PATH//:/ } |grep $1 |which $1
for filename in /usr/share/applications/$1.desktop ; do
File=$(basename $filename)
C1=$(echo -e -n "$File " | cut -b-35 )
C2=$(grep -i -s "comment=" $filename | cut -d'=' -f2)
echo "$C1 $C2" | cut -b-$X
done
fi
fi
fi
fi
fi
#end#