-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrewindday3.sh
More file actions
56 lines (39 loc) · 803 Bytes
/
Copy pathrewindday3.sh
File metadata and controls
56 lines (39 loc) · 803 Bytes
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
49
50
51
#!/bin/bash
for i in 1 2 3 4 5
do
echo "$i"
done
array=( 0 33 12 121 1212 hi "hello" )
len=${#array[*]}
for ((i =0 ;i<=len;i++))
do
echo "${array[i]}"
done
file="/mnt/c/Users/naras/OneDrive/Documents/Learning-ShellScripting/names.txt"
for i in $(cat $file)
do
echo "$i"
done
read -p "enter your age " age
read -p "enter your country " country
if [ $age -ge 18 ] && [ $country == "india" ]
then
echo "you can vote"
else
echo "you cannot vote"
fi
[ $age -ge 18 ] && echo "adult" || echo "minor"
echo "enter your choice "
echo "a for apple"
echo "b for bat"
echo "c for cat"
echo "d for date"
read choice
case $choice in
a)echo "apple";;
b)echo "bat"
echo "the batman";;
c)echo "cat";;
d)date;;
*)echo "invalid input try from a-d";;
esac