且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

分割字符串仅获得前5个字符

更新时间:2023-02-20 10:52:01

您不能同时处于多个cwd中.要为每个与模式匹配的目录运行命令,可以使用Dir#glob:

You can't be in multiple cwds simultaneously. To run the command for each directory that matches the pattern, you can use Dir#glob:

Dir.glob('/var/cache/acpchef/src/ap-kernelmodule-10*').each do |cwd|
  Mixlib::ShellOut.new("command run here", cwd: cwd).run_command
end