I'm a bit unclear why you don't simply do: Pid_to_kill=$(sockstat -l4|grep 5953|awk '{ print $3 }') Kill $pid_to_kill Or just combine it all and do: Kill $(sockstat -l4|grep 5953|awk '{ print $3 }') To get a string to be treated like a command and executed, you place it inside $(), not quotes. Hth, Phil. Cheers, Phil. -----Original Message----- From: Blind-sysadmins [mailto:blind-sysadmins-bounces@lists.hodgsonfamily.org] On Behalf Of David Mehler Sent: 12 April 2018 23:13 To: blind-sysadmins Subject: [Blind-sysadmins] sh shell scripting, FreeBSD Hello, I'm working on a shell script on FreeBSD specifically an rc startup script but I'm hoping what i'm asking is not BSD-specific but rather an sh shell syntax question. I've got a program that when daemonized it runs on 127.0.0.1 on port 5953, I am attempting to get that process, which does not have it's own pidfile (nor does it have the option support to make one), but does show up in a sockstat output, and kill it. If at the bash shell I do: sockstat -l4|grep 5953|awk '{print $3}' I get the specific number i'm wanting to kill and no more. If I put that command in my rc script stop section when that command is run I get the whole sockstat line, It finds the specific line I'm needing but does not find the specific number I'm looking for. What I've tried: fsstop="sockstat -l4|grep 5953|awk '{print $3}'" #stop_cmd="sockstat -l4|grep 5953|awk -F " " '{print $3}'|killall -" stop_cmd="${fsstop}" I'm assuming what i'm hitting is an sh vs bash shell difference. I'd appreciate any suggestions. Thanks. Dave. _______________________________________________ Blind-sysadmins mailing list Blind-sysadmins@lists.hodgsonfamily.org https://lists.hodgsonfamily.org/listinfo/blind-sysadmins