Trying to create and publish a git repository using git API, can't get bash to use my variable in the commands

I have a list of Subversion Repositories that I am converting to GIT, and I have an array of SVN repository paths (which is what the range is on my for loop), and I am having it scrap the path so that I just have the repository name (what the repo_name=${i##*/} ) is for, and then I have it make what the endgame URL is to be for the repository (the URL variable assignment), then I'm using the git API commands to create on GitHub a repository, which is where my issue is.

I need the curl --data command to name the repository what ever the value of repo_name is at that moment in the for loop. I guess the issue is that I have a variable inside of the string. I need to get the repo_name value to be what it names the repository, because right now it names the repository -repo_name.

for i in "${svn_repos[@]}";

    curl --data '{"name":"${repo_name}"}' -X POST -u jjohnson304
    git svn clone $i
    git remote add origin ${url}
    git push -u origin master


  • Variables are not expanded inside of single quotes. You need to use double quotes for the --data argument, with the quotes inside it escaped as \".

    curl --data "{\"name\":\"${repo_name}\"}" -X POST -u jjohnson304