So I am still learning shell scripting and am trying to figure out how to return a string of numbers. My code is as follows:
#!/bin/bash
read -p "Enter NUM1 " NUM1
read -p "Enter NUM2 " NUM2
if [ $NUM1 -gt $NUM2 ]; then $NUM1=g1 && $NUM2=g2
elif [ $NUM2 -gt $NUM1 ]; then $NUM2=g1 && $NUM1=g2; fi
for VALUE in $@; do
if [ $VALUE -lt $g1 ] && [ $VALUE -gt $g2 ]; then COUNT=$((COUNT+1)); fi
done
echo $VALUE happened $COUNT times
Essentially I would pass a list of numbers and want the number of matches between g1 and g2 returned as well as the the matches themselves. Any help is appreciated.