function::MAJOR - Linux
Overview
The function::MAJOR
command extracts the major tuple value from a function. A tuple is a sequence of values separated by commas and enclosed in parentheses, e.g. (1, 2, 3)
. The major value is the first value in the tuple.
Syntax
function::MAJOR <function name>
Options/Flags
None
Examples
function::MAJOR (plus 1 2)
# Output: 3
function::MAJOR (list 1 2 3)
# Output: 1
Common Issues
None
Integration
The function::MAJOR
command can be used with other Linux commands and tools to extract the major value from a function and perform further processing. For example, it can be used with the awk
command to extract the major value from multiple functions and print the results:
functions=( "plus 1 2" "list 1 2 3" )
for function in "${functions[@]}"; do
major=$(function::MAJOR "$function")
echo "$major"
done
Related Commands
function::MINOR
: Extracts the minor tuple value from a function.function::TUPLE
: Extracts the entire tuple from a function.