How to get variable from text file into Bash variable

后端 未结 2 1241
我在风中等你
我在风中等你 2021-02-05 03:41

Simple question, in BASH I\'m trying to read in a .pid file to kill a process. How do I read that file into a variable. All the examples I have found are trying to read in man

2条回答
  •  不知归路
    2021-02-05 04:13

    You're almost there:

    CurPID=$(<"$PIDFile")
    

    In the example you gave, you don't even need the temp variable. Just do:

    kill -9 $(<"$PIDFile")
    

提交回复
热议问题