bash - How to write pass input into this specific Unix Scripting -
this question has answer here:
i trying make commands, can create repo in own github account.
#!/bin/bash a=$1 curl -u 'myname' https://api.github.com/user/repos -d '{"name":$a}'
but not work expected. point that, how can pass $1, first argument, $a.
by way, manual code works:
curl -u 'myname' https://api.github.com/user/repos -d '{"name":"new_folder"}'
moreover, if makes code
curl -u 'myname' https://api.github.com/user/repos -d '{"name":"$1"}'
the corresponding folder created named -1, not looking for.
ps: if makes code
curl -u 'myname' https://api.github.com/user/repos -d '{"name":'"$a"'}'
then above turns out error.
shawn:~$ ./gitcp test enter host password user 'myname': { "message": "problems parsing json", "documentation_url": "https://developer.github.com/v3" }
replace
'{"name":$a}'
by
'{"name":'\""$a"\"'}'
Comments
Post a Comment