Linux Programmer | RHCE | RHCSA

Search This Blog

Tuesday, 8 November 2016

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

No comments:

Post a Comment

SSH not working with password after upgrade ubuntu 22.04 or above

In recent upgrade of ubuntu 22.04 and above we are not able to login server with SSH password. but when we try to login with key then it all...