If you want to open 10 new Terminal windows from a bash script (or from the command line), use the following command:
osascript -e 'tell application "Terminal"' -e 'repeat 10 times' -e 'do script ""' -e 'end repeat' -e 'end tell'
Or integrated into your existing code, albeit re-coded:
#!/bin/bash
shopt -s nocasematch
read -p " Execute script? (y/n): " response
if [[ $response == y ]]; then
printf " Loading....\\n"
for ((x = 0; x<10; x++)); do
printf " Open %s Terminal\\n" $x
osascript -e 'tell application "Terminal" to do script ""' >/dev/null
done
fi
shopt -u nocasematch
Its output would be:
$ ./codetest
Execute script? (y/n): y
Loading....
Open 0 Terminal
Open 1 Terminal
Open 2 Terminal
Open 3 Terminal
Open 4 Terminal
Open 5 Terminal
Open 6 Terminal
Open 7 Terminal
Open 8 Terminal
Open 9 Terminal
$
With 10 new Terminal windows showing, assuming you've not set to have new windows open in tabs.
#!) per file, so your#!/usr/bin/pythonis unnecessary / ignored.