I am trying to make this commands, which can create a repo in my own github account.
#!/bin/bash
a=$1
curl -u 'MYNAME' https://api.github.com/user/repos -d '{"name":$a}'
But it does not work as I expected. The point is that, how can I pass $1, which is the first argument, into $a.
By the way, this manual code works:
curl -u 'MYNAME' https://api.github.com/user/repos -d '{"name":"NEW_FOLDER"}'
Moreover, if I makes the code like
curl -u 'MYNAME' https://api.github.com/user/repos -d '{"name":"$1"}'
the corresponding folder created will named as -1, which is not what I am looking for.
PS: if I makes the code like
curl -u 'MYNAME' https://api.github.com/user/repos -d '{"name":'"$a"'}'
Then the above turns out to be an error.
shawn:~$ ./gitcp test
Enter host password for user 'MYNAME':
{
"message": "Problems parsing JSON",
"documentation_url": "https://developer.github.com/v3"
}