문제

I just read the comparison of PHP, Perl, Ruby and Python

http://hyperpolyglot.org/scripting

and saw the following code sample.

files = `ls -l /tmp`
unless $?.success?
  raise "ls failed"
end

files = %x(ls)
unless $?.success?
   raise "ls failed"
end

I was wondering what $? stands for....

도움이 되었습니까?

해결책

$? contains the last executed command's exit code. Which can be accessed as $?.exitstatus

다른 팁

$? means exit status of last executed child process

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top