#!/bin/bash IFS=',' read -ra USER_ARRAY <<< "$SYNC_USERS" for index in "${!USER_ARRAY[@]}"; do USER_PASS="${USER_ARRAY[index]}" export "SYNC_USER$((index+1))=$USER_PASS" done # Now start the anki-sync-server echo "Starting anki sync server..." exec anki-sync-server