code:nice_scripts
Table of Contents
Nice Scripts
Welcome to Shell Scripting!
Parsing Configs
The file.csv file content is :
user0001;password0001;user0002;password0002 user0011;password0011;user0012;password0012 ...
And the shell program is just :
{ while IFS=';' read u1 p1 u2 p2; do imapsync --user1 $u1 --password1 $p1 --user2 $u2 --password2 $p2 ... done ; } < file.csv
Bash Readarray
Better than the above while read
loop is the use of Bash's builtin
readarray
as it allows to avoid spawning a sub-shell and therefore variable
assignments from inside the loop work.
code/nice_scripts.txt · Last modified: 2021/03/08 17:57 by 127.0.0.1