自动删除菜单条目作为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/menuWatch out for line wrapping, it is all one line. But, is there a better way?
更多推荐
发布评论