Расширение переменной оболочки Bash в Curl в Cmder

На компьютере с Windows 7 в эмуляторе Cmder в окне Git bash я пытаюсь зафиксировать текущую дату в формате ISO:

$ date +%s
1513354497

для отправки внутри тела POST-запроса curl:

$curl.sh -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache"  -d '{"restricted":true,"marquardtRole":"ContentStreamReservedTagMARQUARDTBIWEEKLYUPDATE","description":"Bi-weekly update covering Marquee development and go-to-market functions.","assetClasses":["Commodities","Credit","Currencies","Economics","Emerging Markets","Equities Macro","Equities Micro","Interest Rates","Prime Services"],"authoringDivision":"SECDIV","titlePattern":"(?i)Marquardt Weekly Update.*","name":"Marquardt BIWEEKLY UPDATE", "updatedBy": "d37286ac275911d788f1b1f11ac60222","updated":"'"date +%s"'"}' "http://localhost.abc.com:8000/maq-app-cnts/services/pubs"     

Вот исключение, которое я получаю:

<!--                                                                                                              
The request did not match any of the requests defined for this endpoint.                                          
Request definition 1: The JSON object in the body does not conform to the schema                                  
error: instance type (string) does not match any allowed primitive type (allowed: [&quot;integer&quot;])          
    level: &quot;error&quot;                                                                                      
    schema: {&quot;loadingURI&quot;:&quot;definition:/DateTimeInteger#&quot;,&quot;pointer&quot;:&quot;&quot;}    
    instance: {&quot;pointer&quot;:&quot;/updated&quot;}                                                          
    domain: &quot;validation&quot;                                                                                
    keyword: &quot;type&quot;                                                                                     
    found: &quot;string&quot;                                                                                     
    expected: [&quot;integer&quot;]                                                                               

-->   

Как передать date +%s для правильного расширения в bash?

Спасибо.


person Simeon Leyzerzon    schedule 15.12.2017    source источник
comment
Дубликат stackoverflow.com/questions/30327847/   -  person Camusensei    schedule 07.03.2018


Ответы (1)


Вместо '... ,"updated":"'"date +%s"'"}' используйте '... ,"updated":"'"$(date +%s)"'"}' См. https://stackoverflow.com/a/30327963/4486184

person Camusensei    schedule 07.03.2018