Skip to content

Instantly share code, notes, and snippets.

@nikAizuddin
Created November 30, 2014 20:01
Show Gist options
  • Select an option

  • Save nikAizuddin/88af1f860a4e3363d054 to your computer and use it in GitHub Desktop.

Select an option

Save nikAizuddin/88af1f860a4e3363d054 to your computer and use it in GitHub Desktop.
BCN2053 Operating System Lab Sheet 6 (RUBY)
#!/bin/ruby
# ==========================================================
# Write a shell script, which will ask you for input 'yes'
# or 'no' and based on that will give you what is your
# input;
#
# a) If you enter yes as your input, it will echo you have
# entered yes.
#
# b) If you enter no as your input, it will echo you have
# entered no.
#
# c) No or invalid input is given, then gives error
# 'no input given'
# ==========================================================
printf("yes or no?\n");
answer = gets.chomp;
if answer == "yes"
printf("You have entered yes\n");
elsif answer == "no"
printf("You have entered no\n");
else
printf("No input given\n");
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment