[英]Show kernel version on two lines in Conky
I use 3 different kernels: 5.19.1-xanmod1-x64v2, 5.19.1-051901-generic, and 5.18.0-17.1-liquorix-amd64.我使用 3 个不同的内核:5.19.1-xanmod1-x64v2、5.19.1-051901-generic 和 5.18.0-17.1-liquorix-amd64。 Conky uses $kernel to display the full kernel version I'm using at the time.
Conky 使用 $kernel 来显示我当时使用的完整 kernel 版本。 I want to to display the info on two lines like so:
我想在两行上显示信息,如下所示:
5.19.1 5.19.1
xanmod1-x64v2 xanmod1-x64v2
5.19.1-051901 5.19.1-051901
generic通用的
5.18.0-17.1 5.18.0-17.1
liquorix-amd64甘草-amd64
I can get the first part by using ${exec uname -r |我可以使用 ${exec uname -r | 获得第一部分sed "s/ -[az]. //"} but can't figure out a way to get the second part.
sed "s/ -[az]. //"} 但无法找到获得第二部分的方法。 Any suggestions?
有什么建议么? Thanks.
谢谢。
It's considerably more complex, but the command它要复杂得多,但是命令
sed 's/\([0-9][\.0-9]*\)\([-0-9][\.0-9]*\)\?-\(.*\)/\1\2\n\3/'
outputs info for each of your kernels on two lines, as shown below.在两行上输出每个内核的信息,如下所示。
[David@Fedora64 ~]$ echo 5.19.1-051901-generic | sed 's/\([0-9][\.0-9]*\)\([-0-9][\.0-9]*\)\?-\(.*\)/\1\2\n\3/'
5.19.1-051901
generic
[David@Fedora64 ~]$ echo 5.19.1-xanmod1-x64v2 | sed 's/\([0-9][\.0-9]*\)\([-0-9][\.0-9]*\)\?-\(.*\)/\1\2\n\3/'
5.19.1
xanmod1-x64v2
[David@Fedora64 ~]$ echo 5.18.0-17.1-liquorix-amd64 | sed 's/\([0-9][\.0-9]*\)\([-0-9][\.0-9]*\)\?-\(.*\)/\1\2\n\3/'
5.18.0-17.1
liquorix-amd64
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.