我正在学习如何将我的 NIC 传递到我的 KVM。
本指南说将以下代码添加到文件 ~/.bashrc
#!/bin/bash
# change the 999 if needed
shopt -s nullglob
for d in /sys/kernel/iommu_groups/{0..999}/devices/*; do
n=${d#*/iommu_groups/*}; n=${n%%/*}
printf 'IOMMU Group %s ' "$n"
lspci -nns "${d##*/}"
done;
Run Code Online (Sandbox Code Playgroud)
我不清楚代码应该插入哪里,所以它在第1-8行。
1 #!/bin/bash
2 # change the 999 if needed
3 shopt -s nullglob
4 for d in /sys/kernel/iommu_groups/{0..999}/devices/*; do
5 n=${d#*/iommu_groups/*}; n=${n%%/*}
6 printf 'IOMMU Group %s ' "$n"
7 lspci -nns "${d##*/}"
8 done;
9
10 # ~/.bashrc: executed by bash(1) for non-login …Run Code Online (Sandbox Code Playgroud)