Trying to find lsof version information
Hi ALL,
I am running a script on several hundred boxes and trying to fing the version of lsof they have. I have created a scipr for that which runs "lsof -v" through ssh on those boxes. I am taking output as: line=`lsof -v | sed '/^$/d' | grep "revision"` echo $line. But $line is not storing anything?? i dont know why, i think the control is not passing to script , after lsof is run. How can i do that. Appreciate your help in this regard. |
Redirection
You need to redirect stderr for this to work.
line=`lsof -v 2>&1 | sed '/^$/d' | grep "revision"` echo $line Example output :- revision: 4.80 latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ compiler version: 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux) |
Hi,
Thanks scobiej.Its working :) Can you explain why we need to do that? |
Because the version info is "debug" output, it's not lsof's core
business. You would have noticed that when you run your command w/o assigning it to a variable that the "grep" doesn't seem to take, and that you get a whole lot of info? Cheers, Tink |
Ok. Thanks for the help.
|
All times are GMT -5. The time now is 10:33 AM. |