Skip to content

user Functions

🛠️ Tools · ⬅ Home


See also group functions.

Usage

userHome [ pathSegment ]

The current user HOME (must exist) No directories should be created by calling this, nor should any assumptions be made about the ability to read or write files in this directory.

Arguments

  • pathSegment - String. Optional. Add these path segments to the HOME directory returned. Does not create them.

Return codes

  • 1 - Issue with buildEnvironmentGet HOME or $HOME is not a directory (say, it's a file)
  • 0 - Home directory exists.

Usage

userRecord index [ user ] [ database ]

Look user up, output a single user database record.

Writes to standard output

String. Associated record with index and user.

Arguments

  • index - PositiveInteger. Required. Index (1-based) of field to select.
  • user - String. Optional. User name to look up. Uses whoami if not supplied.
  • database - File. Optional. User name database file to examine. Uses /etc/passwd if not supplied.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Requires

grep cut returnMessage printf /etc/passwd whoami

Usage

userRecordHome [ user ] [ database ]

Look user up, output user home directory

Writes to standard output

Directory. The user home directory.

Arguments

  • user - String. Optional. User name to look up. Uses whoami if not supplied.
  • database - File. Optional. User name database file to examine. Uses /etc/passwd if not supplied.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Usage

userRecordName [ user ] [ database ]

Look user up, output user name

Writes to standard output

the user name

Arguments

  • user - String. Optional. User name to look up. Uses whoami if not supplied.
  • database - File. Optional. User name database file to examine. Uses /etc/passwd if not supplied.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error