dotfiles/.config/i3blocks/kernel/kernel_version.sh

34 lines
918 B
Bash
Raw Normal View History

2021-11-15 20:32:56 +01:00
#!/bin/bash
# Parameters
longNumber=2
kernelCommand="uname -r"
archCommand=$(uname -m)
# Kernel version
kernelVersion=""
count=1
# Extract numbers of kernel version
kernelVersionTemp=$(uname -r | cut -d "." -f ${count})
kernelVersionTempDot="${kernelVersionTemp}"
kernelVersion="${kernelVersion}${kernelVersionTempDot}"
count=$(expr ${count} + 1)
while [ ${count} -le ${longNumber} ] ; do
kernelVersionTemp=$(uname -r | cut -d "." -f ${count})
kernelVersionTempDot=".${kernelVersionTemp}"
kernelVersion="${kernelVersion}${kernelVersionTempDot}"
count=$(expr ${count} + 1)
done
kernelVersionTemp=$(uname -r | cut -d "." -f ${count} | cut -d "-" -f 1)
kernelVersionTempDot=".${kernelVersionTemp}"
kernelVersion=${kernelVersion}${kernelVersionTempDot}
# Apply arch
kernelVersion=${kernelVersion}-${archCommand}
2021-12-04 21:33:24 +01:00
#echo "Kernel: Linux ${kernelVersion} "
echo "Linux ${kernelVersion} "
2021-11-15 20:32:56 +01:00