eu quero substituir a saída para texto

0

eu tenho abaixo do Código.

curl -X POST --data-urlencode 'payload={"channel": "#general", "username": "webhookbot", "text": "This is posted to #general and comes from a bot named webhookbot.", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/xxxxxxxxxxxxxxxxxxxx

este comando envia This is posted to #general and comes from a bot named webhookbot para Slack Channel , agora eu quero substituir Isto com a saída de

wc -l ips.txt | awk '{print $1}'

eu quero isso:

curl -X POST --data-urlencode 'payload={"channel": "#general", "username": "webhookbot", "text": "OUTPUT OF wc -l command , like number 154", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/xxxxxxxxxxxxxxxxxxxx

Como posso fazer isso?

    
por Mehran Goudarzi 03.03.2017 / 16:09

2 respostas

1
curl -X POST --data-urlencode "payload={'channel': '#general', 'username': 'webhookbot', 'text': \"$(wc -l ips.txt | awk '{print $1}')\", 'icon_emoji': ':ghost:'}" https://hooks.slack.com/services/xxxxxxxxxxxxxxxxxxxx
    
por 03.03.2017 / 19:52
0

Você deve poder usar backticks para expansão de comando:

curl -X POST --data-urlencode 'payload={"channel": "#general", "username": "webhookbot", "text": "'wc -l ips.txt | awk '{print $1}''", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/xxxxxxxxxxxxxxxxxxxx
    
por 03.03.2017 / 16:15