while loop
This commit is contained in:
		| @@ -9,32 +9,22 @@ mapfile -t array < <(cli -m csv -c 'app chart_release query name,update_availabl | |||||||
| update_limit=2 | update_limit=2 | ||||||
| current_updates=0 | current_updates=0 | ||||||
|  |  | ||||||
|  | it=0 | ||||||
| while true | while [[ $it -lt ${#array[@]} ]] | ||||||
| do | do | ||||||
|     if [[ current_updates -ge "$update_limit" ]]; then |     jobs=$(jobs -p | wc -l) | ||||||
|         sleep 5 |     if [[ "$jobs" -ge "$update_limit" ]]; then | ||||||
|  |         sleep 3 | ||||||
|     else |     else | ||||||
|         for i in "${array[@]}" |         update_apps "${#array[$it]}" & | ||||||
|         do |  | ||||||
|             { update_apps "$i"; (( current_updates-- )) ;} & (( current_updates++ )) |  | ||||||
|         processes+=($!) |         processes+=($!) | ||||||
|         done |         ((it++)) | ||||||
|     fi |     fi | ||||||
| done | done | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| for proc in "${processes[@]}" | for proc in "${processes[@]}" | ||||||
| do | do | ||||||
|     wait "$proc" |     wait "$proc" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user