LinuxCommandLibrary

isaset

Display supported instruction set architectures

SYNOPSIS

isaset [VARIABLE_NAME]

PARAMETERS

VARIABLE_NAME
    The name of the variable or property to check. This can be a udev property (prefixed with '+'), a systemd variable (prefixed with '-'), or a standard environment variable (no prefix).

DESCRIPTION

isaset is a utility program often found as part of the systemd suite. Its primary function is to determine whether a specified variable or property is "set," meaning it exists and holds a non-empty value. This command is particularly useful in shell scripts, systemd unit files, udev rules, and other contexts where conditional logic based on the presence of certain system or environment attributes is required.

It can check udev properties (prefixed with '+'), systemd variables (prefixed with '-'), or standard environment variables (no prefix). It returns an exit status of 0 if the variable is set and non-empty, and a non-zero exit status otherwise. This makes it ideal for use in if statements or &&/|| constructs, enabling robust scripting and configuration management within systemd-managed systems. By abstracting away the complexities of sourcing specific system variables, isaset provides a straightforward and consistent interface for querying system state.

CAVEATS

  • Primarily designed for systemd and udev environments.
  • It checks for non-empty string values. A variable set to '0' or 'false' is still considered "set" by isaset if it's not an empty string.
  • Its functionality can often be replicated with standard shell parameter expansion checks (e.g., [ -n "$VAR" ]), but isaset provides specific handling and context for udev properties and internal systemd variables.

RETURN VALUE

isaset returns an exit status of 0 if the variable is set and non-empty, and a non-zero exit status (typically 1) if the variable is not set or is empty. This makes it suitable for use in conditional shell logic like if statements or &&/|| constructs.

VARIABLE TYPES

The command interprets the prefix of VARIABLE_NAME to determine the type of variable to check:
+PROPERTY: Checks a udev property. Example: isaset +ID_BUS
-VARIABLE: Checks a systemd variable. Example: isaset -VIRTUALIZATION
VARIABLE: Checks a standard environment variable. Example: isaset PATH

HISTORY

isaset is a component of the systemd project, which was initially released in 2010 by Lennart Poettering and Kay Sievers. Its inclusion serves to provide a dedicated, robust way to check system properties within the systemd ecosystem, particularly useful in udev rules processing where direct shell variable checks might be less convenient or reliable for system-specific attributes. Its integration with systemd ensures consistent behavior when dealing with udev properties and internal systemd variables.

SEE ALSO

systemd(1), udev(7), udevadm(8), systemctl(1), test(1)

Copied to clipboard