Having credentials file like this one:
db: db_name
user: username
password: password
After this command has been run:
awk '$1 ~ /db:|user:|password:/ { print $2 }' credentials \
| while read line; do c+=($line); done;
, I won't have a possibility to echo out my ${c[@]} array, because pipe process has terminated, and variable is gone. How would I manage to save that after while loop is terminated, so that I could use elements of that c array, as credentials for example in following command:
mysql -u ${c[1]} -p${c[2]} ${c[0]} < file.sql