Want to pass the current month to grep so it lists current month's logins for a specific user. Script below does echo the current month, ($mnth), but grep doesn't do anything with it. If I hard code the month("Sep") instead of $mnth, I get the correct output - last month of logons. I guess working solution should apply to the year "2020" also.
#!/bin/bash
echo -e '\n'
echo $SHELL
echo -e '\n'
mnth=$(date +%b)
echo $mnth
last -F john_paul_jones | grep -E '$mnth ([ 1-9]|1[0-9]|2[0-9]|30)' | grep 2020 |more
Thanx