[Klug-general] auto-delete menu entries as part of a bash script

Sharon Kimble boudiccas at talktalk.net
Mon Nov 25 19:21:44 UTC 2013


On Mon, 25 Nov 2013 18:56:26 +0000
James Morris <jwm.art.net at gmail.com> wrote:

> Ah ok, I see why it doesn't work now, the menu doesn't simply take the
> command name as title.
> 
> Have a look here, hopefully slightly clearer:
> https://gist.github.com/jwm-art-net/7646636
> 
Brilliant, thanks. I'll now adapt the two working lines to fit into
'mengen'. Thanks very much :)

Sharon.
> James.
> 
> On 25 November 2013 18:20, Sharon Kimble <boudiccas at talktalk.net>
> wrote:
> > I've attached my fluxbox menu so that you can see the actual menu
> > entries that I want to delete in 'others'. This menu is generated
> > with 'menumaker' and this attached script called 'mengen' which
> > I've also attached. I want to be able to add the command to delete
> > the menu entries into 'mengen' so that it is able to delete them
> > from all future menus. Every-time a new programme is installed into
> > fluxbox/debian and it generates a new menu item, so a new menu will
> > need to be generated. These entries are put in place by 'menumaker'
> > which is several python scripts, but if you want to have a look at
> > 'menumaker' its available at my git repo, as listed in my sig. Hope
> > this helps?
> >
> > Sharon.
> >
> > On Mon, 25 Nov 2013 17:22:46 +0000
> > James Morris <jwm.art.net at gmail.com> wrote:
> >
> >> You can use sed with a regular expression:
> >> sed  '\|\[exec[]]\s[(]\(.*\)[)]\s[{]/usr/lib/xscreensaver/\1
> >> -root[}]|d' path/to/menufile
> >>
> >> the above command output the menufile to stdout minus matching
> >> lines, it assumes no variation in spaces between the { and }
> >> characters from the example you showed.
> >>
> >> once you have confirmed that it works and is not removing lines
> >> which you do not wish removed, pass the -i option for it to edit
> >> the file proper.
> >>
> >> i've tested it in debian, using the following file:
> >>
> >> ----8<--------8<--------8<--------8<--------8<----
> >>
> >> [begin] (Fluxbox 1.3.5)
> >> [encoding] {UTF-8}
> >>       [exec] (xterm) {xterm}
> >>       [exec] (firefox) {firefox}
> >>       [exec]   (Run) {fbrun}
> >> [submenu] (Terminals)
> >>       [exec]   (xterm) {xterm}
> >> [end]
> >>
> >>
> >> [exec] (foobar) {/usr/lib/xscreensaver/foobar -root}
> >> [exec]  (foobar1) {/usr/lib/xscreensaver/foobar1 -root}
> >> [exec] (foobar)   { /usr/lib/xscreensaver/foobar -root }
> >> [exec] (fooba3r)  {/usr/lib/xscreensaver/fooba3r  -root }
> >> [exec] (bar) {/usr/lib/xscreensaver/bar -root}
> >> [exec] (barf) {/usr/lib/xscreensaver/barf -root}
> >>
> >> ----8<--------8<--------8<--------8<--------8<----
> >>
> >> note it won't remove the menu entries with the extra spaces between
> >> { }.
> >>
> >> james.
> >>
> >> On 25 November 2013 16:08, Sharon Kimble <boudiccas at talktalk.net>
> >> wrote:
> >> >
> >> > I want to delete menu commands that are in the form of -
> >> >
> >> > [exec] (foobar) {/usr/lib/xscreensaver/foobar -root}
> >> >
> >> > and there are 50+ commands to be deleted as part of a
> >> > bash-script. But, how do I do it please? I need some form of
> >> > commands that I can put into my menu generation script, which
> >> > will auto-delete them in the future. Can anyone help please?
> >> >
> >> > Thanks
> >> > Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
efever = http://www.efever.blogspot.com/
efever = http://sharon04.livejournal.com/
my git repo = https://bitbucket.org/boudiccas/dots
Debian testing, Fluxbox 1.3.5, LibreOffice 4.1.3.2
Registered Linux user 561944
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/kent/attachments/20131125/4516a6a8/attachment.pgp>


More information about the Kent mailing list