dircolors 定义中的通配符?
我正在设置一个 .dir_colors
文件,但我有一些问题我似乎无法弄清楚。
我有想要彩色的 PBS 作业脚本,它工作得很好:
.job 01;35
但是这些脚本的输出分别生成两个文件:输出和错误,其形式为:
.job.o354282 .job.e354282
其中 PBS 作业编号为 354282。我真的很想突出显示这两个文件类型,但我能想到的唯一方法是使用通配符,例如:
.job.o* 01;37
.job.e* 01;36
这似乎不起作用。显然,我无法对每个文件扩展名可能性进行硬编码,因为我无法预测我的工作编号是什么。有没有办法在 .dir_colors 文件中使用通配符,或者其他方法来解决这个问题?
谢谢。
I'm setting up a .dir_colors
file, but I have a bit of an issue I can't seem to figure out.
I have PBS job scripts that I want colored, which work fine:
.job 01;35
But the output of these scripts generate two files each: output and error, which take the form:
.job.o354282 .job.e354282
Where the PBS job number is 354282. I'd really like to highlight both types, but the only way I can think of doing this is with wildcards like:
.job.o* 01;37
.job.e* 01;36
Which doesn't seem to work. I obviously can't hard code in every file extension possibility as I can't predict what my job numbers will be. Is there a way to use wildcards in a .dir_colors
file, or some other way to solve this problem?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您生成的作业文件看起来遵循预定义的格式。也许您可以将其格式更改为:
或其他格式,以便扩展名保持不变,因为 LS_COLORS。
Your generated job files look like they follow a predefined format. Perhaps you can change their format to:
or whatever so that the extension remains the same as wildcards are not supported in LS_COLORS.
这是不可能的。 ls 命令不接受通配模式。您可以通过手动设置 LS_COLORS 来测试它:
上面的代码会将 rpm 文件渲染为红色以及以“.o*”结尾的文件。它们的文件名中必须包含“*”。尝试一下:
It is not possible. The ls command does not accept a globbing pattern. You can test it by setting the LS_COLORS by hand:
The above will render rpm files red and those wich end on '.o*'. They must have a '*' in the file name. Try it with: