Platform Functionality
Execution
whichExists
Does a binary exist in the PATH?
Usage
whichExists [ --any ] binary ... [ --help ]
Return Code: 0 - If all values are found Return Code: 1 - If any value is not found
Arguments
--any- Flag. Optional. If any binary exists then return 0 (success). Otherwise, all binaries must exist.binary ...- Required. String. One or more Binaries to find in the systemPATH.--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error
Requires
throwArgument which decorate __decorateExtensionEach
runCount
Run a binary count times
Usage
runCount count binary [ args ... ]
Return Code: 0 - success
Return Code: 2 - count is not an unsigned number
Return Code: Any - If binary fails, the exit code is returned
Arguments
count- The number of times to run the binarybinary- The binary to runargs ...- Any arguments to pass to the binary each run
Return codes
0- Success1- Environment error2- Argument error
makeShellFilesExecutable
Makes all
*.shfiles executable
Usage
makeShellFilesExecutable [ --find findArguments ] [ path ... ]
Makes all *.sh files executable
Arguments
--find findArguments- Optional. Add arguments to exclude files or paths. SPACE-delimited for multiple options.path ...- Optional. Directory. One or more paths to scan for shell files. Uses PWD if not specified.
Return codes
0- Success1- Environment error2- Argument error
Environment
- Works from the current directory
Modify PATH or MANPATH
pathConfigure
Modify the PATH environment variable to add a path.
Usage
pathConfigure [ --help ] [ --first ] [ --last ] [ path ]
Modify the PATH environment variable to add a path.
Arguments
--help- Optional. Flag. Display this help.--first- Optional. Place any paths after this flag first in the list--last- Optional. Place any paths after this flag last in the list. Default.path- the path to be added to thePATHenvironment
Return codes
0- Success1- Environment error2- Argument error
pathRemove
Remove a path from the PATH environment variable
Usage
pathRemove [ --help ] [ path ]
Remove a path from the PATH environment variable
Arguments
--help- Optional. Flag. Display this help.path- Requires. String. The path to be removed from thePATHenvironment.
Return codes
0- Success1- Environment error2- Argument error
pathCleanDuplicates
Cleans the path and removes non-directory entries and duplicates
Usage
pathCleanDuplicates [ --help ]
Cleans the path and removes non-directory entries and duplicates
Maintains ordering.
Arguments
--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error
Environment
- PATH - DirectoryList. A colon
:separated list of paths to search for executables inbash. SeepathConfigure
pathShow
Show the path and where binaries are found
Usage
pathShow [ --help ]
Show the path and where binaries are found
Arguments
--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error
Modify MANPATH
manPathConfigure
Modify the MANPATH environment variable to add a path.
Usage
manPathConfigure [ --help ] [ --first ] [ --last ] [ path ]
Modify the MANPATH environment variable to add a path.
Arguments
--help- Optional. Flag. Display this help.--first- Optional. Place any paths after this flag first in the list--last- Optional. Place any paths after this flag last in the list. Default.path- the path to be added to theMANPATHenvironment
Return codes
0- Success1- Environment error2- Argument error
manPathRemove
Remove a path from the MANPATH environment variable
Usage
manPathRemove [ --help ] path
Remove a path from the MANPATH environment variable
Arguments
--help- Optional. Flag. Display this help.path- Directory. Required. The path to be removed from theMANPATHenvironment
Return codes
0- Success1- Environment error2- Argument error
manPathCleanDuplicates
Cleans the MANPATH and removes non-directory entries and duplicates
Usage
manPathCleanDuplicates [ --help ]
Cleans the MANPATH and removes non-directory entries and duplicates
Maintains ordering.
No-Arguments: default
Arguments
--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error
Memory
processMemoryUsage
Outputs value of resident memory used by a process, value
Usage
processMemoryUsage pid
Outputs value of resident memory used by a process, value is in kilobytes
Return Code: 0 - Success Return Code: 2 - Argument error
Arguments
pid- Process ID of running process
Examples
> processMemoryUsage 23
Sample Output
423
Return codes
0- Success1- Environment error2- Argument error
processVirtualMemoryAllocation
Outputs value of virtual memory allocated for a process, value
Usage
processVirtualMemoryAllocation [ --help ] [ pid ]
Outputs value of virtual memory allocated for a process, value is in kilobytes
Return Code: 0 - Success Return Code: 2 - Argument error
Arguments
--help- Optional. Flag. Display this help.pid- Process ID of running process
Examples
processVirtualMemoryAllocation 23
Sample Output
423
Return codes
0- Success1- Environment error2- Argument error
CPU
loadAverage
Get the load average using uptime
Usage
loadAverage [ --help ]
Get the load average using uptime Uptime output: 0:00 up 30 days, 6:02, 19 users, load averages: 15.01 12.66 11.64 Uptime output: 05:01:06 up 8 days, 4:03, 0 users, load average: 3.87, 3.09, 2.71
Writes to standard output
lines:Number
Arguments
--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error
Requires
uptime
Services
serviceToPort
Get the port number associated with a service
Usage
serviceToPort service [ ... ]
Get the port number associated with a service
Return Code: 1 - service not found Return Code: 2 - bad argument or invalid port Return Code: 0 - service found and output is an integer
Arguments
service- A unix service typically found in/etc/services--services servicesFile- Optional. File. File like '/etc/services`.--help- Optional. Flag. Display this help.
Sample Output
Port number of associated service (integer) one per line
Return codes
0- Success1- Environment error2- Argument error
serviceToStandardPort
Hard-coded services for:
Usage
serviceToStandardPort [ --help ] [ service ... ]
Hard-coded services for:
ssh-> 22http-> 80https-> 80postgres-> 5432mariadb-> 3306mysql-> 3306
Backup when /etc/services does not exist.
Return Code: 1 - service not found Return Code: 0 - service found and output is an integer
Arguments
--help- Optional. Flag. Display this help.service ...- String. Optional. A unix service typically found in/etc/services
Sample Output
Port number of associated service (integer) one per line
Return codes
0- Success1- Environment error2- Argument error
Users and Groups
groupID
Convert a group name to a group ID
Usage
groupID groupName
Convert a group name to a group ID Return Code: 0 - All groups were found in the database and IDs were output successfully Return Code: 1 - Any group is not found in the database. Return Code: 2 - Argument errors (blank argument)
Writes to standard output
Integer. One line for each group name passed as an argument.
Arguments
groupName- String. Required. Group name to convert to a group ID
Return codes
0- Success1- Environment error2- Argument error
Requires
throwArgument getent cut printf usageDocument decorate grep quoteGrepPattern
Miscellaneous
JSON
Format something neatly as JSON
Usage
JSON < inputFile > outputFile
Format something neatly as JSON
Arguments
--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error