2017-04-21 7 views
0

curl urlをこのようにフォーマットして成功させる必要があります。bashでcurl urlを作成する

$instanceUrl/sobjects/$sObject/describe -H 'Authorization: Bearer $apiToken' 

これまでのスクリプトです。行25::のsObjects /調査は/説明-H:そのようなファイルまたはディレクトリ」

#!/bin/bash 
CURL='/usr/bin/curl' 
CURLARGS='-H' 

echo "welcome to sf-db-mock" 

echo "please enter the instance url of the Salesforce org database you'd like to mock, followed by [ENTER]:" 

# get rest endpoint 
read instanceUrl 

echo "please enter your api token, followed by [ENTER]:" 

# get api token from users current session 
read apiToken 

# get the objects the users wants described 
echo "please enter each sObject you'd like to mock by entering its API Name, using a space after each sObject, followed by [ENTER]:" 

read -a sObjects 

for sObject in ${sObjects[@]} 

do 
    describe="$('sobjects'\/$sObject\/'describe '$CURLARGS ' Authorization: Bearer '$apiToken)" 
    echo $instanceUrl$describe 
done 

それを実行している間、私が手にエラーが

./mock.txtです私のbashスクリプトは実行可能です。

答えて

0

表記$(a b c)は、引数bcを指定して実行コマンドaを意味します。

describe="sobjects/$sObject/describe $CURLARGS 'Authorization: Bearer '$apiToken'" 
:あなたが欲しい

は括弧を削除することです

関連する問題