A
A
alexdora2016-06-19 19:36:33
ruby
alexdora, 2016-06-19 19:36:33

How to take only the first line of the output?

The construction is as follows:
sysAnswer = system("command")
The output is always:
The first line with the result
true
Further sysAnswer is used in the if condition
How can I do it without true. I 'm redoing someone else's script and zero-zero in Ruby.
I looked on the Internet, there are also constructions a la %[" but they give me a launch error.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Little_CJIOH, 2016-06-23
@alexdora

system("command") replace with system("command | head -1")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question