Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit d2af073

Browse files
committed
Fixed hcdiag chk-ib-pcispeed.sh lspci parsing for RHEL 8
1 parent cfe821e commit d2af073

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

hcdiag/src/tests/chk-ib-pcispeed/chk-ib-pcispeed.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# hcdiag/src/tests/chk-ib-pcispeed/chk-ib-pcispeed.sh
55
#
6-
# © Copyright IBM Corporation 2015,2016. All Rights Reserved
6+
# © Copyright IBM Corporation 2015-2022. All Rights Reserved
77
#
88
# This program is licensed under the terms of the Eclipse Public License
99
# v1.0 as published by the Eclipse Foundation and available at
@@ -45,8 +45,8 @@ count=0
4545
err=0
4646
for a in `lspci |grep ${VENDOR} | awk '{print $1}'`; do
4747
line=`sudo lspci -s $a -vv | grep "LnkSta:"`
48-
speed=`echo ${line} | awk '{print substr($3,1,length($3)-1)}'`
49-
width=`echo ${line} | awk '{print substr($5,1,length($5)-1)}'`
48+
speed="$(echo "${line}" | awk 'match($0, /Speed\s*([0-9]+GT\/s)/, a) {print a[1]}')"
49+
width="$(echo "${line}" | awk 'match($0, /Width\s*(x[0-9]+)/, a) {print a[1]}')"
5050
echo "Adapter: $a, $speed, $width."
5151
if [ "$SPEED" != "$speed" ]; then
5252
echo "Error, expecting: $SPEED, got: $speed"

0 commit comments

Comments
 (0)