diff options
| author | hachem <im@hachem.wtf> | 2026-10-21 06:45:53 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-10-21 06:45:53 +0200 |
| commit | 6f8e692be1c196113b91ad1986a00c9d6f6f0e48 (patch) | |
| tree | 642bf354c1eacf3e67cdb3d41437586dfe44e4c0 /gils/chown.rv | |
| parent | 306e9cb38e3922093708dfbbaf12979edff2b788 (diff) | |
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 |
