In case of an AIX system and the usernames are know, I would use another way like:
HASH=HASH=$(grep -p $USERNAME /etc/security/passwd | awk '/password/ {print $3}') echo "${USERNAME}:$HASH" Certainly the search for "password" could be coded even more strictly.