BASH SCRIPT 输出不导出到文件中

BASH SCRIPT output doesn't export in file

我只是坚持我的自编码应用程序调用 ws 命令(网络套接字),我正在尝试导出输出。我还想在 JSON 后端 devlopment

的 API 输入一段时间后完成 wscat 退出
#!/bin/bash
while getopts a:c: flag
do
    case "${flag}" in
        a) accesskey=${OPTARG};;
    c) clientnodeid=${OPTARG};;     
    esac
done
master="wscat -c ws://localhost:8091/ws/callback -H accessKey:$accesskey -H clientNodeId:$clientnodeid"
sleep 15
eval $master
final=$(eval echo "$master")
echo $final >>logfile.log
ps -ef | grep wscat | grep -v grep | awk '{print }' | xargs kill
#curl -X POST --data "$final" -k "https://localhost:7460/activate" -H "accept: application/json" -H "accessKey:$accesskey" -H "clientNodeId:$clientnodeid" -H "Content-Type: application/json" -H "callbackRequested:true"
exit 

我想调用 wscat 的输出以通过 curl 发送 当我手动 运行 脚本时,它成功了,但是当我从另一个应用程序 (java) 调用它时,它是 运行ning 但没有生成日志。

总而言之,我想将 $final 导出到文本文件,我应该将它导入到 --data of curl calling

基于修正:

You're overcomplicating this with all those variables. Just do

eval "$master" >> logfile.log