Built-in Functions

 Built-in Functions

Command Definition
abs() Return the absolute value of a number
accept() Accept a socket connection
acos() Return the arcosine of the argument
args() Returns an array containing the calling application command line arguments.
asctime() Returns the formatted date/time of seconds since 1970-01-01 00:00:00 UTC
asin() Returns the arcsine of sine, that is, the length in radians of the arc.
assert() Exits the program immediately with a non-zero status if `expr` is `false` optionally displaying `msg` to standard error.
atan() returns the arctangent of tangent
base64dec() Returns the base64 decoded output
base64enc() Returns the base64 encoded output of the given string
basename() Returns the last element of path.
bin() Returns the binary equivalent of a given number.
bind() Connect to a socket file descriptor using host:port
bool() Converts the given value to a boolean..
cat() Returns the contents of file filename as a single string.
cd() Move to a different directory.
checkip() Checks the given IP address is valid
chmod() Change the access permissions of the named file.
chown() Change the numeric uid and gid of the named file.
chr() Returns the ASCII character of the given integer.
cos() returns the cosine of radians. The output range for the cos() function is -1 ≤ cos() ≤ 1.
count() Return the number of elements with the specified value.
cp() Copies a file to another named file or destination.
cumulative() Returns an array by increasing by one element after another, and including all the amounts that have been added before.
cut() Returns the text before and after the given separator.
date() Returns the current date and time as a 24-character string.
delete() Remove the designated key and it’s content from the named hash.
difference() Return the list of elements that are unique to a specified array.
dirpath() Return the list of elements that are unique to a specified array.
exit() Exit script immediately with a given status.
extend() Adds the specified list elements to the end of the first named list.
fields() Returns an array of a string split around one or more consecutive white spaces.
file() Returns information about a file.
first() Return the first element of an array.
float() Returns a string or integer as a floating point number.
getegid() Returns the numeric effective group id of the calling process.
getenv() Returns the value of the named environment variable.
geteuid() Returns the numeric effective user id of the caller.
getgid() Returns the numeric group id of the calling process.
getpid() Returns the process id of the running program.
getppid() Returns the process id of the running program’s parent process.
getuid() Returns the numeric user id of the running process.
getwd() Returns a rooted path name corresponding to the current directory.
glob() Returns an array of file names matching the glob pattern.
hasprefix() Tests whether a string begins with the chosen prefix.
hassuffix() Tests whether the string ends with suffix.
hex() Returns the hexadecimal version of a decimal number.
hostname() Returns the host name of the computer.
include() Inserts the contents of another file into the source code
index() Returns the position in a string or array at which search string begins.
input() Return result of a string entered by keyboard.
insert() Returns the result of inserting the specified value at the specified position of an array.
int() Returns a string or floating point number as an integer.
ipincidr() Returns the IP address if it belongs in a CIDR block.
issorted() Checks if an array is already sorted.
join() Returns a string created from a concatenated array and separator.
keys() Returns an array of hash keys.
kill() Terminate a given process.
last() Returns the last element of an array.
len() Return the length of a string, hash, or array.
ltrim() Returns a string with all leading characters contained in cutset removed.
match() Returns a string holding the text of the leftmost match of the regular expression.
mkdir() Create a directory.
mkdirhier() Create a directory and any parent directory.
oct() Returns the octal equivalent of a decimal number.
ord() Returns the ASCII value of a given character.
pop() Removes and returns the element from the end of the array.
print() Prints text to the current console/terminal.
printf() Formats according to a format specifier and writes to standard output.
println() Prints text to the current console/terminal.
push() Returns an array with the appended value.
random() Returns a pseudo-random integer.
range() Returns a sequence of numbers.
readpw() Returns non-echoed keyboard input.
regexp() Returns an array of matched lines from a file.
repeat() Returns a new string consisting of n copies of the string.
replace() Returns a copy of the string s with the first n non-overlapping instances of old replaced by new.
replaceall() Returns a copy of the string s with all non-overlapping instances of old replaced by new.
reverse() Returns the reversed contents of an array or string.
rtrim() Returns a string with all trailing characters contained in cutset removed.
set() Return hash or array with modified/added key/pair, or array index.
setenv() Sets the value of the environment variable named by the key.
shift() Returns a new array with the first element of `array` removed..
shuffle() Returns a new array with the elements in a random order.
sin() Returns the sine of a number.
sinh() Returns the hyperbolic sine of a number.
sleep() Pauses the application for the stated duration.
socket() Returns a file descriptor of a socket awaiting configuration.
sort() Returns a new array with data in ascending order.
sortips() Returns an array of IP address in ascending order.
split() Splits a string into an array.
splithostport() Splits a string of host:port values into an array
sprintf() Formats according to a format specifier and returns the result.
string() Returns any data type as a string.
substr() Returns a substring of a given string indicated by the starting position and the substring length.
sum() Returns a number, the sum of all items in an array.
swap() Returns a new array, with the values of the given indexes swapped.
syslog() Simple interface to the system log service.
system() Returns the output of a system command as a string.
tan() Returns the tangent of the radian argument.
tanh() Returns the hyperbolic tangent of the argument.
time() Returns the number of seconds since 00:00:00 GMT January 1, 1970.
tmpnam() Creates a new temporary file.
tolower() Returns a string where all characters are lower case.
toupper() Returns a string where all characters are upper case.
touch() Updates the modification time of a given file.
trim() Returns a string with all leading and trailing characters contained in cutset removed.
trimprefix() Returns a string with the stated prefix removed.
trimsuffix() Returns a strings with the stated suffix removed.
type() Returns the data type of the given value.
ucount() Returns a hash containing a count of unique elements in an array
union() Returns a set that contains all items from the original array, and all items from the specified array(s).
uniq() Returns an array with all duplicates removed.
unlink() Removes the named file or empty directory.
unsetenv() Unsets a single environment variable.
whoami() Returns the username (login name) of the user that is running the current process.
zip() Returns a new array using combined elements of named arrays.