Bash Script Array Variable Length Pipe