Clone all Repos from a Bitbucket source

I have about 22 repositories on bitbucket and downloading them can be a pain. Here’s a short script to make life easier:

#Script to get all repositories under a user from bitbucket
#Usage: [username]

curl -u ${1}${1} > repoinfo
for repo_name in `grep \"name\" repoinfo | cut -f4 -d\"`
	hg clone ssh://${1}/$repo_name

UPDATE: Corrected a typo. Many thanks to fr3d3r1cbaz1n for pointing it out! Also, as fr3d3r1cbaz1n noted, this script only works for Mercurial but git users can easily change the hg command to git.