How do I pass the $line to the cut command properly in this loop?
while read line do login= $(cut -d : -f 1) done < /etc/passwd
I can't do
$(cut -d : -f 1 $line) so what is the correct way?
You don't actually need the while loop if your intention is only to list the names. Also there is a syntax error after
or as you tried:
To answer your question, the bash here-string would be useful: