Java While Loop Through An Array Bash Script Substring In Python