plate55
asked on
Write a simple shell script
I need help writing a simple shell script that solicits a (Y)es or (N)o response from the user. If the response is 'Y' display a message on the screen that thanks the user for the positive response. If the response is 'N' display a message that thanks the user for the negative response. If the answer is anything else, redisplay the question.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you can try something like this:
first do
# which perl
and then just change first line of cript according you output
--------------------------
#!/usr/bin/perl
while ($input ne 'y'){
print "\(Y/N\)\n";
chomp($input = <STDIN>);
if ($input eq 'y') {
print "answer yes\n";
} elsif ($input eq 'n') {
print "answer no\n";
$input='y';
}
}