Skip to content

Instantly share code, notes, and snippets.

@okochang
Created March 7, 2014 02:53
Show Gist options
  • Save okochang/9404466 to your computer and use it in GitHub Desktop.
Save okochang/9404466 to your computer and use it in GitHub Desktop.
指定された引数(hoge,foo,bar)によってexit終了ステータスが変わる
# -*- coding: utf-8 -*-
option = ARGV[0]
def exit_test(option)
if option == "hoge"
puts "正常終了でほげ"
exit 0
elsif option == "foo"
puts "異常終了でふー"
exit 1
elsif option == "bar"
puts "異常終了でばー"
exit 2
else
puts "なんだこれー"
exit 3
end
end
exit_test(option)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment