Docker from bash script gives machine does not exist

using mac osx 10.9.5 seem to be having issue when executing docker from script.
virtual box is latest version at 5.0.12

created a test.sh with
sudo /usr/local/bin/docker-machine ls
i get get a machine does not exist error-any idea?

ponks$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1

ponks$ ./test.sh
Password:
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Error Unknown machine does not exist

any ideas? many thanks

had some joy by removing the
#!/bin/bash at the top of the script