Run linux command in ruby -


i'm trying following..

   if "ps | grep -e file"       true;    else       false; 

what need make string n if statement execute linux command listed?

simply use system("command"). it'll return true if command executed.

edit read question again, , believe you're looking this:

if `ps | grep -e file`.empty? # no matches   true else   false end 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -