whats wrong with this code

ls -ld | grep $1 /etc/passwd | cut -d: -f6

i need see the content...

$1 is the first argument of a command... i don't understand what you want to achieve with the above...

If you want to ls for directories of the homedirectory of user $1:

ls -ld $(grep "$1" /etc/passwd | cut -d: -f6)

Regards

Can you please explain a bit what you are trying to achieve. What string are you searching in the passwd file?

There's no need to look at /etc/passwd or to use an external command (unless your shell doesn't have printf built in):


eval "printf '%s\n' ~$1/*/"