ForNext
Only Do What Only You Can Do
204. external command
Hyperpolyglot Interpreted Languages: PHP, Perl, Python, Ruby より (2012.05.08)
VBScript
JScript
Perl
system("ls -l /tmp") == 0 or die "ls failed";
PHP
system("ls -l /tmp", $retval); if ($retval) { throw new Exception("ls failed"); }
Python
if os.system('ls -l /tmp'): raise Exception('ls failed')
Ruby
unless system("ls -l /tmp") raise "ls failed" end