capture the output to a variable
I want to assign the value of a certain pid in order to kill it in a script
Quote:
Quote:
Quote:
How can I put the single number in a variable? Thanks. |
i'm guessing you've not heard aboput the pidof command?
Code:
pidno=$(pidof dhcpcd) Code:
pidno=$(ps ux | ... ) |
Other than typo in dhcpd ( dhcpcd ) I would go with
Code:
pidno=$(pidof dhcpd) Code:
pidno=$(echo `ps ux | grep dhcpd | grep -v grep` | cut -d' ' -f2) |
Thank you, all four solutions work.
Btw, homey, the process is not a typo; I'm using this program: dhcpcd at freshmeat Thanks again. :) |
Quote:
|
All times are GMT -5. The time now is 10:11 AM. |