diff options
Diffstat (limited to 'gils/chown.rv')
| -rw-r--r-- | gils/chown.rv | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gils/chown.rv b/gils/chown.rv new file mode 100644 index 0000000..b64101d --- /dev/null +++ b/gils/chown.rv @@ -0,0 +1,17 @@ +# chown <user> <path> +# chown lung hachem + +const context = env.ctx + +if context.argv:len() < 3 do + fail("usage: chown <user> <path>\n") +end else do + const uid = user_uid(context.argv[1]) + if uid < 0 do + fail("chown: #{context.argv[1]}: no such user\n") + end else do + const path = expand_path(context.argv[2]) + if (fs:chown(path, uid) == :false) + fail("chown: #{path}: no such file\n") + end +end |
