Answer the question
In order to leave comments, you need to log in
How to loop through all the elements of a bash array?
Good afternoon.
Given:
There is an array ${users[@]} - it consists of usernames, users 20.
There is such a command (connects to the database,
mysql -u root -p`cat .mysqlpasswdfile` -e "CREATE USER 'user '@'localhost' IDENTIFIED BY 'user'"
Question:
Please tell me how to write an expression so that at each pass of the loop the name from the array is substituted, moreover, each time a new one, and so on until the last name.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question