我试图使用erlang shell将-rxrxr-x分配给文件说file.txt。 但是我们需要在分配记录之前定义记录。 而这一切我想在erlang shell中做。
答案 0 :(得分:2)
您可以在shell中使用rr(Module)
来加载给定模块中的记录定义。有关详细信息,请参阅shell文档。
例如:
1> rr(file).
[file_descriptor,file_info]
2> {ok, Info} = file:read_file_info("hello.erl").
{ok,#file_info{size = 0,type = regular,access = read_write,
atime = {{2016,11,4},{14,8,35}},
mtime = {{2016,11,4},{14,8,35}},
ctime = {{2016,11,4},{14,8,35}},
mode = 33188,links = 1,major_device = 64512,
minor_device = 0,inode = 5769215,uid = 1000,gid = 1000}}
3> Info2 = Info#file_info{ mode = 8#00600 }.
#file_info{size = 0,type = regular,access = read_write,
atime = {{2016,11,4},{14,8,35}},
mtime = {{2016,11,4},{14,8,35}},
ctime = {{2016,11,4},{14,8,35}},
mode = 384,links = 1,major_device = 64512,minor_device = 0,
inode = 5769215,uid = 1000,gid = 1000}
4> ok = file:write_file_info("hello.erl", Info2).