Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 更新Ubuntu 16.04上GO项目的Bash脚本_Linux_Bash_Ubuntu_Go - Fatal编程技术网

Linux 更新Ubuntu 16.04上GO项目的Bash脚本

Linux 更新Ubuntu 16.04上GO项目的Bash脚本,linux,bash,ubuntu,go,Linux,Bash,Ubuntu,Go,伙计们。 我不熟悉bash脚本编写和在ubuntu上部署Go。 我像这样运行我的围棋程序 go build -o myprogram main.go ./myprogram & 但是现在,我不再使用sftp上传文件,而是手动更改我想要编写的简单bash脚本 问题是,我首先需要杀死现有的进程,我不知道如何得到PID并杀死它 也许我可以用一些不同的东西运行我的程序,这样我就不必找到PID 我尝试使用ps-ax | grep-myprogram,然后将其杀死,但运气不佳bash有一个特殊变量

伙计们。 我不熟悉bash脚本编写和在ubuntu上部署Go。 我像这样运行我的围棋程序

go build -o myprogram main.go
./myprogram &
但是现在,我不再使用sftp上传文件,而是手动更改我想要编写的简单bash脚本

问题是,我首先需要杀死现有的进程,我不知道如何得到PID并杀死它

也许我可以用一些不同的东西运行我的程序,这样我就不必找到PID


我尝试使用ps-ax | grep-myprogram,然后将其杀死,但运气不佳

bash
有一个特殊变量
$可用于存储最近启动的后台进程的进程id

./myprogram &
myprogram_PID=$!

kill "$myprogram_PID"

你想终止你作为
/myprogram&
?@Inian启动的进程,是的,这是我想要的解决方案之一