On Wednesday 15 November 2006 00:33, Kevin Donnelly wrote:
I have a list of usernames and passwords in a csv file, and what I'm trying to do is loop through each user, run the password through htpasswd, and write both to a file for Apache directory restriction.
The usernames and passwords are in fields 9 and 10 of the file respectively, and I was trying to do the loop via: for user in $(awk 'BEGIN { FS = ";" } ; {print $9}' user_pw.csv) do password="awk 'BEGIN { FS = ";" } ; {print $10}' user_pw.csv) echo "User $user has password $password" done But that gives an error: bash: syntax error near unexpected token `" } ; {print $10}' user_pw.csv"' I've tried escaping the ";" in different ways, but none of them seem to work.
Can anyone suggest a way to get bash to do what I want?
declare -a foo while IFS=':' read -a foo; do echo user ${foo[8]} has password ${foo[9]} done --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org