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
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