Skip to content

user Functions

🛠️ Tools · ⬅ Top


See also group functions.

userHome

The current user HOME (must exist)

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. Return Code: 1 - Issue with buildEnvironmentGet HOME or $HOME is not a directory (say, it's a file) Return Code: 0 - Home directory exists.

Arguments

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

Return codes

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

userRecord

Quick user database look up

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

userRecordHome

Quick user database query of the user home directory

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

userRecordName

Quick user database query of the user name

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