# chmod num do let value = 0 for index in 0..text:len() do const code = text[index]:ascii() if (code >= 48 and code <= 55) value = value * 8 + (code - 48) end return value end const context = env.ctx if context.argv:len() < 3 do fail("usage: chmod \n") end else do const mode = parse_octal(context.argv[1]) const path = expand_path(context.argv[2]) if (fs:chmod(path, mode) == :false) fail("chmod: #{path}: no such file\n") end