@ThreadSafe public final class ShellUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ShellUtils.ExitCodeException
This is an IOException with exit code added.
|
Modifier and Type | Field and Description |
---|---|
static String |
COMMON_SSH_OPTS
Common shell OPTS to prevent stalling.
|
static String |
MOUNT_COMMAND
a Unix command for getting mount information.
|
static String |
SET_PERMISSION_COMMAND
a Unix command to set permission.
|
static String |
TOKEN_SEPARATOR_REGEX
Token separator regex used to parse Shell tool outputs.
|
Modifier and Type | Method and Description |
---|---|
static String |
execCommand(String... cmd)
Static method to execute a shell command.
|
static String[] |
getGroupsForUserCommand(String user)
Gets a Unix command to get a given user's groups list.
|
static String[] |
getSetPermissionCommand(String perm,
String filePath)
Returns a Unix command to set permission.
|
static List<UnixMountInfo> |
getUnixMountInfo()
Gets system mount information.
|
static UnixMountInfo |
parseMountInfo(String line) |
public static final String COMMON_SSH_OPTS
public static final String SET_PERMISSION_COMMAND
public static final String MOUNT_COMMAND
public static final String TOKEN_SEPARATOR_REGEX
public static String[] getGroupsForUserCommand(String user)
user
- the user namepublic static String[] getSetPermissionCommand(String perm, String filePath)
perm
- the permission of filefilePath
- the file pathpublic static List<UnixMountInfo> getUnixMountInfo() throws IOException
IOException
public static UnixMountInfo parseMountInfo(String line)
line
- the line to parseUnixMountInfo
public static String execCommand(String... cmd) throws IOException
cmd
- shell command to executeIOException
Copyright © 2023. All Rights Reserved.