Add/Remove Main Menu From List in Lubuntu

Script :

File For menu is Located At: /etc/xdg/lubuntu/menus/lxde-applications.menu
(Chnange The Path of menu file in script)

menu="$1"

check=`grep -i "<Name>$menu<\/Name>" /tmp/lxde-applications.menu`
if [ -n "$check" ];
then
line0=`cat /tmp/lxde-applications.menu | grep -n "<Name>$menu<\/Name>" | cut -d$
line1=$((line0-1))
line2=`cat /tmp/lxde-applications.menu | grep -B 1 -A 25 -n "<Name>$menu<\/Name$
bline=$((line2+1))
sed -n "${line1},${line2}p" /tmp/lxde-applications.menu  >/tmp/"$menu"
app="<!--$menu-->"
sed -i ''$line1'i\'$app'\' /tmp/lxde-applications.menu

echo "$line1==>$line0==>$bline"
sed -i ''$line0','$bline'd' /tmp/lxde-applications.menu

else
        echo "Menu Not Exists"
fi

To Run Script:
./script_name.sh {menu-name}

To Add Deleted Menu :
sudo sed -i '/<!---DesktopSettings--->/r /tmp/DesktopSettings' lxde-applications.menu

sudo sed -i '/<!--DesktopSettings-->/d' /tmp/lxde-applications.menu

Comments

Popular posts from this blog

Error while connecting RDP "an authentication error has occurred the token supplied to the function is invalid".

Windows shared network printer issue in ubuntu 18.04

Rename printer from command line in ubuntu.