Page 1 of 1

How can I improve this uninstall script? SOLVED

Posted: Thu 02 May 2013, 00:47
by oldyeller
Hello Everyone,

I have this uninstall script and I would like to improve on it.

Code: Select all

#!/bin/sh

Xdialog -title="Uninstalling" --yesno "Do you really want to Remove Believe?" 0 0
if [ $? -eq 0 ]; then
  rm -f /usr/local/bin/Believe
  rm -r /usr/local/Manna/Believe
  rm -f /usr/local/bin/rmBelieve
fi
What I would like to do is be able to remove this entry in fluxbox menu;

Code: Select all

[exec] (Believe) {Believe}
The menu is customize. Just not sure on how to code it. If this can't be done by the script. Than have it open the menu.base for manual editing.

Any help would be great.

Thanks

Posted: Thu 02 May 2013, 03:56
by stu91
Maybe?

Code: Select all

sed -i '/Believe/d' /menu/file

Posted: Thu 02 May 2013, 15:26
by oldyeller
stu91 wrote:Maybe?

Code: Select all

sed -i '/Believe/d' /menu/file
Will give it a try.

I did figure out how to have the script open a window that states were to delete the line in the menu.base and than open up the menu.base.

This is the code that I added and I figured out how to do my first Xdialog I will have to finish this I am on the wrong puppy :lol: :lol:


EDIT:: Now I am on the right puppy :D

Code: Select all

Xdialog -title="Deleting" --msgbox "Delete line 44 in menu.base, after deleting hit refresh in the menu under settings-fluxbox" 0 0

exec geany /root/.fluxbox/menu.base

Posted: Thu 02 May 2013, 15:43
by oldyeller
stu91 wrote:Maybe?

Code: Select all

sed -i '/Believe/d' /menu/file
This did not work.

Thanks

Posted: Thu 02 May 2013, 15:56
by L18L

Code: Select all

sed -i '/Believe/d' $HOME/.fluxbox/menu.base
should delete every line containing Believe in /root/.fluxbox/menu.base

Posted: Thu 02 May 2013, 16:12
by oldyeller
L18L wrote:

Code: Select all

sed -i '/Believe/d' $HOME/.fluxbox/menu.base
should delete every line containing Believe in /root/.fluxbox/menu.base
This did the trick :D

Thanks L18L

Posted: Thu 02 May 2013, 16:13
by stu91
oldyeller wrote:
stu91 wrote:Maybe?

Code: Select all

sed -i '/Believe/d' /menu/file
This did not work.

Thanks
As L18L points out make sure it points to where ever the fluxbox menu file is located, the -i flag is edit in place.

could also use:

Code: Select all

grep -v  'Believe' /menu/file > /tmp/menu/file
rm -f /menu/file && mv -f /tmp/menu/file /menu/file
grep none matching string lines and send to new /tmp/menu/file - remove old /menu/file and move new /tmp/menu/file to its place.

Posted: Thu 02 May 2013, 16:20
by oldyeller
Hi stu91,

Thanks will take a look at this as well


Cheers

Posted: Thu 02 May 2013, 16:38
by L18L
Hi stu91,

did not know this
grep -v ...............
before
thank you :)