I am trying to write a script that can accept multiple options. The issue that I'm having is some of the potential input will be search criteria.
The syntax would be:
script
- [-t seconds] [-n count]
- All of the arguments are optional.
- So far, my thoughts were to have the script write the "list of patterns" to an array and then process the arguments. My problem is I can't figure out how to make the script differentiate between a pattern and an argument.
- This is what I have so far that will read every argument into an array:
if [ $# -ne $NO_ARGS ]; then
GREPARRAY="$@"
INDEX2="$#"
fi
echo $INDEX2
for PATTERN in ${GREPARRAY[@]}; do
echo $PATTERN
done
Any assistance would be appreciated.
Thanks.