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"\"'}' 

see: difference between single , double quotes in bash


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -