小编Whi*_*Rau的帖子

CentOS8 中的 Virtualbox 来宾添加安装出现“未找到内核标头”错误

CentOS8运行./VBoxLinuxAdditions.run出现如下错误:

Kernel headers not found for target kernel 4.18.0-193.6.3.el8_2.x86_64. Please install them and execute /sbin/rcvboxadd setup
ValueError: File context for /opt/VBoxGuestAdditions-6.0.22/other/mount.vboxsf already defined
modprobe vboxguest failed
Run Code Online (Sandbox Code Playgroud)

如何安装所需的内核头文件?

centos virtualbox

6
推荐指数
2
解决办法
2万
查看次数

grep 无法处理 for 循环中的文件名

学习 bash 脚本,我正在尝试使用 for 循环中的嵌套 grep 来过滤结果:

sample filenames:
  this-file_AAC.txt
  this-other_file_AAAC.txt
  yep-a-file_AAC.nfo
  oops_another_one.reamde
Run Code Online (Sandbox Code Playgroud)

这是脚本:

shopt -s globstar nullglob dotglob
for file in ./**/*.{txt,reamde,nfo}; do
  printf "input: ${file}\n"
  if grep -qF _AAC $file; then
    printf "output: ${file}\n"
    # do stuff with $file
  fi
done
Run Code Online (Sandbox Code Playgroud)

这个想法是任何包含的文件都_AAC将对其应用操作;在这种特定情况下,只需打印到标准输出即可确认结果是否正确。

问题是:没有什么可以超越if陈述。所以我错过了我不知道什么。唯一有效的就是这printf "input...条线。

我缺少什么?

linux grep bash

1
推荐指数
1
解决办法
497
查看次数

标签 统计

bash ×1

centos ×1

grep ×1

linux ×1

virtualbox ×1