more help with bash script please
i cant for the life of me figgure out how to get the output of this into a variable:
ps -A | grep myprocessname | awk '{print $1}' i can get it in as a string, ive tried all sorts of stuff, but i would just like to have the output of that in a variable called "pid" please and thanks |
Using backticks ( ` ) like this ....
#!/bin/bash pid=`ps -A | grep firefox | awk '{print $1}'` echo "$pid" |
edit:
i spoke too soon, works great |
edit: i spoke too soon
|
Quote:
|
sorry, it all works, i just forgot to change firefox to the name of my program
thanks for the help, it works perfectly (sidenote: using ""'s perserves whitespeace, but withouth them the content wil still be output) |
Yeah, I'm used to having something else along with the variable. :)
Like this... echo "This is your pid: $pid" |
All times are GMT -5. The time now is 04:29 AM. |