-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.sh
executable file
·43 lines (42 loc) · 878 Bytes
/
script.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
#! /bin/bash
name="Rajarshi Dutta"
echo my name is $name
read -p "Enter your name: " NAME
if [ $NAME == "Rishi" ]
then
echo Hello $NAME , nice to meet ya
else
echo your name is not $NAME,
fi
FILE="sample.txt"
if [ -e $FILE ]
then
echo $FILE is a file
else
echo $FILE is not a file
fi
read -p "Are you studying in IITK" ans
case $ans in
[yY] | [yY][eE][sS])
echo "Astro club is an exciting club, shoud try it out :)"
;;
[nN] | [nN][oO])
echo "Sorry you cant experience the Astro Club, better luck somewhere :/"
;;
*)
echo "Please enter either yes or no :)"
;;
esac
FILES=$(ls *.txt)
NEW=1
for FILE in $FILES
do
echo "Renaming $FILE to new-$FILE"
#rename file to new-filename
mv $FILE $NEW.txt
((NEW++))
done
mkdir hello
touch "hello/hw.txt"
echo "Hello,I am Rishi" >> "hello/hw.txt"
echo "file created "