curl命令适用于终端,但不适用于shell脚本

时间:2018-05-14 09:31:02

标签: bash curl

我正在编写一个bash脚本,要求服务器通过API发送信息并更改有关该信息的状态。

从终端这对我有用:

curl -s -w "GET" https://mysite/page.php?id=43982934&send=Yhd6yryr87237846dh&status=1";

如果我从浏览器转到同一个网址,它就可以了。但是当我使用此命令从我的脚本内部运行它时,没有任何作用。

cmd='curl -s -w "GET" https://mysite/page.php?id=43982934&send=Yhd6yryr87237846dh&status=1"';

尝试直接像终端一样运行它,但无法让它工作。

修改

脚本是这样的:

#!/bin/bash
cmd='curl -s -w "GET" "https://mysite/page.php?id=43982934&send=Yhd6yryr87237846dh&status=1"'
    if [ "$var" != "$extension" ]; then
            ffmpeg -i /var/www/html/temp/name.extension -c copy /var/www/html/temp/namefile.extension
    fi;
cmd='curl -s -w "GET" "https://mysite/page.php?id=43982934&send=Yhd6yryr87237846dh&status=2"'

我需要为每个ffmpeg进程设置一个状态!

0 个答案:

没有答案
相关问题