Check if path is readable.
Example:
# Example for can_read
println can_read("/tmp") # true
Check if path is writeable.
Example:
# Example for can_write
println can_write("/tmp") # true
Changes directory to a given path.
Example:
# Example for cd
println cd("/tmp") # true
Performs a chroot to a given path.
Example:
# Example for chroot
chroot("/mydir")
Copy a single file.
Example:
# Example for copy
copy("/tmp/file1","/tmp/file2")
Returns the current working directory.
Example:
# Example for cwd println cwd() # current working directory
Delete a file.
Example:
# Example for delete
delete("/tmp/file")
Returns an array containing file information on path filepath.
[#SOL]filter can be specified, as a regex, to narrow results.
[#SOL]options_map supports: .depth(int), .names(bool), .exclude(str), .absolute(bool).
[#SOL]Each array element contains name,path,depth,mode,size,mtime and is_dir fields.
[#SOL]These specify filename, full path, recursion depth, file mode, file size, modification time and directory status respectively.
Example:
# Example for dir
println dir("/tmp")
Return all available environmental variables.
Example:
# Example for env println env()
Return the value of the environmental variable key_name.
Example:
# Example for get_env
println get_env("HOME") # /home/user
Returns an array of file paths matching a glob pattern.
[#SOL]pattern specifies the glob pattern (supports *, ?, []).
[#SOL]base_dir optionally specifies the base directory to search in (defaults to current directory).
[#SOL]Returns full paths to all matching files and directories.
Add a system group. Options: gid (auto-allocated if not provided).
Remove a system group.
Get detailed information about a group.
List all system groups with details (gid, members).
Manage group membership. Action: add, remove.
Lookup a group name by group id.
Example:
# Example for groupname println groupname(1000)
Checks if a file mode indicates a device.
Example:
# Example for is_device println is_device(6000) # true for block device mode
Checks if a file mode indicates a named pipe.
Example:
# Example for is_pipe println is_pipe(4516) # false
Checks if a file mode indicates a setgid file.
Example:
# Example for is_setgid println is_setgid(2755) # true/false
Checks if a file mode indicates a setuid file.
Example:
# Example for is_setuid println is_setuid(4755) # true/false
Checks if a file mode indicates a socket.
Example:
# Example for is_socket println is_socket(49152) # false
Checks if a file mode indicates a sticky file.
Example:
# Example for is_sticky println is_sticky(17407) # true/false
Checks if a file mode indicates a symbolic link.
Example:
# Example for is_symlink println is_symlink(41471) # true/false
Returns the parent directory.
Example:
# Example for parent
println parent("/usr/local/bin/") # /usr/local
Rename a file.
Example:
# Example for rename
println rename("/tmp/old","/tmp/new") # true
Set the value of the environmental variable key_name.
Example:
# Example for set_env
set_env("MYVAR","abc")
println get_env("MYVAR") # abc
Sets the umask value. Returns the previous value. umask() without args just returns the current value.
Example:
# Example for umask println umask() # e.g., 18
Add a system user. Options: uid, gid, home, shell, groups, create_home.
Remove a system user. Options: remove_home.
Get detailed information about a user.
List all system users with details (uid, gid, home, shell).
Lookup a username by user id.
Example:
# Example for username println username(1000)