自动删除菜单条目作为bash脚本的一部分(auto

编程入门 行业动态 更新时间:2024-10-23 09:28:18
自动删除菜单条目作为bash脚本的一部分(auto-delete menu entries as part of a bash script)

我想删除以下形式的菜单命令 -

[exec] (foobar) {/usr/lib/xscreensaver/foobar -root}

并且有50多个命令要作为bash脚本的一部分被删除。 但是,我该怎么做呢? 我需要某种形式的命令,我可以将其放入我的菜单生成脚本中,以后将自动删除它们。

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.

最满意答案

这工作 -

sed -i '\|\[exec[]]\s[(].*[)]\s[{]/usr/lib/xscreensaver/.*\s-root[}]|d' ~/.fluxbox/menu; sed -i '\|\[exec[]]\s[(].*[)]\s[{]\b\(xscreensaver\).*[}]|d' ~/.fluxbox/menu

注意换行,这是一条线。 但是,有更好的方法吗?

This works -

sed -i '\|\[exec[]]\s[(].*[)]\s[{]/usr/lib/xscreensaver/.*\s-root[}]|d' ~/.fluxbox/menu; sed -i '\|\[exec[]]\s[(].*[)]\s[{]\b\(xscreensaver\).*[}]|d' ~/.fluxbox/menu

Watch out for line wrapping, it is all one line. But, is there a better way?

更多推荐

本文发布于:2023-08-01 00:52:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1351406.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:条目   脚本   菜单   bash   auto

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!