snipplets.dev/~/Crystal/value_from_match.cr

9 lines
210 B
Crystal

test_string_1 = "rw------- (0o600)"
# test_string_2 = "rwx------ (0o700)"
if /\d{3}/.match(test_string_1).try &.[0] != "600"
puts "Password file permissions is not RW for you.".colorize(:red)
exit(0)
end