-
Notifications
You must be signed in to change notification settings - Fork 0
/
yesno.sh
executable file
·48 lines (44 loc) · 1.07 KB
/
yesno.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#set -x
echo "hi"
read choice
function yesno()
{
read choic
echo function called
case "$choic" in
[yY][eE][sS] )
echo "Please enter the name of key-pair to be created:"
read kp
aws ec2 create-key-pair --key-name $kp --query 'KeyMaterial' --output text > $kp.pem
echo -e "\n\n\n"
echo "Key-pair Created SuccessFully.\n "
chmod 400 $kp.pem
mv $kp.pem ~/
;;
[nN][oO] )
echo "enter name of pem file | Just name - don't include .pem extension"
read kp
echo $kp.pem
;;
*) echo 'Please type either "yes" or "no"' ;yesno ;;
esac
}
#while true; do
case "$choice" in
[yY][eE][sS] )
echo "Please enter the name of key-pair to be created:"
read kp
aws ec2 create-key-pair --key-name $kp --query 'KeyMaterial' --output text > $kp.pem
echo -e "\n\n\n"
echo "Key-pair Created SuccessFully.\n "
chmod 400 $kp.pem
mv $kp.pem ~/
;;
nN][oO] )
echo "enter name of pem file | Just name - don't include .pem extension"
read kp
echo $kp.pem
;;
* ) echo 'Please type either "yes" or "no"'; yesno ;;
esac
#done