linux shell: How to read command argument from a file?

Igor Katkov picture Igor Katkov · Nov 10, 2009 · Viewed 7.2k times · Source

I have process id in a file "pid" I'd like to kill it.

Something like:

kill -9 <read pid from file>

I tried:

kill -9 `more pid` 

but it does not work. I also tried xargs but can't get my head around it.

Answer

sdtom picture sdtom · Nov 10, 2009

Does

kill -9 $(cat pid)

work for you?