29 lines
668 B
Bash
29 lines
668 B
Bash
|
|
#!/bin/bash -
|
||
|
|
|
||
|
|
#
|
||
|
|
# Test script to run the range_parse function
|
||
|
|
#
|
||
|
|
|
||
|
|
set -o nounset # Treat unset variables as an error
|
||
|
|
|
||
|
|
#
|
||
|
|
# Source the function. In a real script you'd want to provide a path and check
|
||
|
|
# the file is actually there.
|
||
|
|
#
|
||
|
|
source range_parse.sh
|
||
|
|
|
||
|
|
#
|
||
|
|
# Call range_parse with the first two arguments provided to this script. Save
|
||
|
|
# the output in the variable 'parsed'. The function is called in an 'if'
|
||
|
|
# statement such that it takes different action depending on whether the
|
||
|
|
# parsing was successful or not.
|
||
|
|
#
|
||
|
|
if range_parse "$1" "$2" parsed; then
|
||
|
|
echo "Success"
|
||
|
|
echo "Parsed list: ${parsed}"
|
||
|
|
else
|
||
|
|
echo "Failure"
|
||
|
|
fi
|
||
|
|
|
||
|
|
exit
|