I am trying to create a small shell script in Solaris which checks the number of connections per month for the current logged in user, but I am having problem in using a variable inside a command in the right way.
This is my script:
current_user=$(who am i | awk '{print $1}')
echo The logins for user \"$current_user\" were:
echo January:
last | awk '$1=="${current_user}" && $5=="Jan" {count++} END {print count}'
echo February:
last | awk '$1=="${current_user}" && $5=="Feb" {count++} END {print count}'
.
.
.
and it prints:
The logins for user "username" were:
January:
February:
.
.
.