See also You'll want vipw and vipw -s to fix this. the home directory is usually at field/column 6, where ":" is the delimiter.

printf "%-12s m %s\n" \ "$" \ "$" \ "$" done I'm not sure what output you expect nor if my code does what you want, but the following code first looks for usernames that appear in (part of) someone's full name. Grep will give you lines from the file that actually contain home directories.

]]

This fails because /etc/shadow is a mountpoint -- which cannot be replaced -- which results in this error (captured using strace): 102 rename("/etc/nshadow", "/etc/shadow") = -1 EBUSY (Device or resource busy) You can reproduce this trivially from ...

In these traditional text files (there are other ways, e.g.

$x - will add character x to the end of the known password $x $y - will add character xy to the end of the known password ^x - will add character x to the end of the known password ^x ^y - will add character xy to the beginning of the known password In addition your "known ...

You changed your home directory, but you probably left the files in the old directory.

When bash is invoked it reads and executes some files, some of them in your home directory (for example ~/.profile).

Since you changed your home directory it doesn't find them.

On my box cygpath -H returns /cygdrive/c/Users "homer" and "root" are the same account.

You can have multiple usernames for a single account. You can store the users in an array from the who command and then while reading the /etc/passwd file, loop through the array to see if the user is present in the array and if so, print the entries from /etc/passwd file in the format you desire. /bin/bash while read -r user throw_away; do users =( "$user" ) done /etc/passwd is a file.

If you change your loop to the following, it will work: while read line ... ) stands for the result of the command, here the biggest id new ID=$(( ...