I would like to replicate the functionality of chsh (or passwd -e) by awk.
This is what I got so far, but I think there should be an easier way to search and replace field $7 only for lines beginning with user_name:
There is no sanity check on the input. You could get a shell that doesn't exist into your passwd. Or is that checked before? Why not use the system commands?