sending a command output to a variable
The following line give me the last ID of radwatch process:
echo `ps aux | grep "[r]adwatch" | awk '{print $2}'` | grep -Eo "[1-9]+$"
now if I want use a variable and assign the same command, the varible will be empty!!
mystring=`ps aux | grep "[r]adwatch" | awk '{print $2}'` | grep -Eo "[1-9]+$"
echo "$mystring"
Any help will be appreciated.
|