I am writing a bash script in which I am storing current date in a variable and then I am greping that variable. Issue is it's not working
currentdate= $(date +%b\ %d)
echo "$currentdate"
last |grep -E '$currentdate'>> /usr/IBM/HTTPServer7/logs/alert/users.txt
users.txt
is showing empty. If I write manually the current date then it works.
What am I doing wrong?
'
vs. double quotes"
. The former won't expand variables. – Sparhawk Dec 04 '18 at 05:58DEC 1
. that date command returnsDEC 01
– BlackCrystal Dec 04 '18 at 06:26