Method: Specinfra::Command::Base::File.check_is_grouped

Defined in:
lib/specinfra/command/base/file.rb

.check_is_grouped(file, group) ⇒ Object

[View source]

35
36
37
38
39
40
41
42
# File 'lib/specinfra/command/base/file.rb', line 35

def check_is_grouped(file, group)
  regexp = "^#{group}$"
  if group.is_a?(Numeric) || (group =~ /\A\d+\z/ ? true : false)
    "stat -c %g #{escape(file)} | grep -- #{escape(regexp)}"
  else
    "stat -c %G #{escape(file)} | grep -- #{escape(regexp)}"
  end
end