Dear Concern,
I want to write a shell script in linux for mail notification of users whose password is about to expire within 7 days or already has expired. Is there any alternative way except to check the "date" command output and compare it with "chage -l username" command output. Please advise.
Okay - there may be way to get the expiry date, but you have to run as root.
I'm guessing you want to run some script as a non-root user at login. You can always work around that requirement with sudo. Or work around the problem with a suid C program.
What is the issue here? So we can give you a decent answer.