What is the difference between the following Ruby methods?
exec, system and %x() or Backticks
I know they are used to execute terminal commands programmatically via Ruby, but I'd like to know why there are three different ways to do this.
What is the difference between the following Ruby methods?
exec, system and %x() or Backticks
I know they are used to execute terminal commands programmatically via Ruby, but I'd like to know why there are three different ways to do this.
In my case worked this.
output = `nmap localhost`
This one saves your output to the variable, so the answer is use `` instead of system.