Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

gh

30 views
ubuntu2004
1
# echo "Mayank"
2
: 'echo "2115000613"
3
echo "85.7"
4
echo -e "Mayank \n 2115000613 \n 85.7"
5
echo -e "Mayank \t 2115000613 \t 85.7"
6
echo "Enter name"
7
read name
8
echo "Enter roll number"
9
read rollnumber
10
echo "my name is $name and roll number is $rollnumber "
11
a=10
12
echo $a
13
a=20
14
unset a
15
echo $a
16
echo "current working directory"
17
whoami
18
echo "listing of files"
19
echo "calendar"
20
cal '
21
# echo "today's date"
22
# date "+%D"
23
# pwd
24
25
: 'echo "first args: $1"
26
echo "second args: $2"
27
echo "third args: $3"
28
echo "total args: $#"
29
echo "process name: $0"
30
echo "process id: $$"
31
echo "argument: $@"
32
echo "args: $*"
33
a=5
34
b=3
35
c=`expr $a \* $b`
36
echo $c '
37
# read two no. and perform all airthematic operation
38
# input 3 no. by command line argument and perform above wala
39
# find avg. of three no.
40
: 'echo "enter value of a"
41
read a
42
echo "enter value of b"
43
read b
44
c=`expr $a + $b`
45
echo $c
46
d=`expr $a - $b`
47
echo $d
48
e=`expr $a / $b`
49
echo $e
50
f=`expr $a \* $b`
51
echo $f '
52
: 'echo "firstargs: $1"
53
echo "secondargs: $2"
54
echo "thirdargs: $3"
55
c=`expr $1 + $2 + $3`
56
echo $c
57
d=`expr $1 - $2 - $3`
58
echo $d
59
e=`expr $1 / $2 / $3`
60
echo $e
61
f=`expr $1 \* $2 \* $3`
62
echo $f '
63
: 'echo "enter value of a"
64
read a
65
echo "enter value of b"
66
read b
67
echo "enter value of c"
68
read c
69
sum=`expr $a + $b + $c `
70
avg=`echo "scale=2 ; $sum / 3" | bc`
71
echo $avg '
72
# THERE must be spaces b/w operation and expressions
73
# all the conditional expressions should be inside square braces with spaces around them
74
# read a
75
# read b
76
# read c
77
# if [ $a -gt $b ]
78
# then
79
# if [ $a -gt $c ]
80
# then
81
# echo "a"
82
# else
83
# echo "c"
84
# fi
85
# else
86
# if [ $b -gt $c ]
87
# then
88
# echo "b"
89
# else
90
# echo "c"
91
# fi
92
# fi
93
# read a
94
# read b
95
# read c
96
# sum=`expr $a + $b + $c `
97
# avg=` echo "scale=0 ; $sum / 3" | bc `
98
# if [ $avg -ge 80 ]
99
# then
100
# echo "first div."
101
# elif [ $avg -ge 65 -a $avg -lt 80 ]
102
# then
103
# echo "second div."
104
# elif [ $avg -ge 45 -a $avg -lt 65 ]
105
# then
106
# echo "third div."
107
# else
108
# echo "fail"
109
# fi
110
# read var
111
# case $var in
112
# 1) echo "monday";;
113
# 2) echo "tuesday";;
114
# 3) echo "wednesday";;
115
# 4) echo "thrusday";;
116
# 5) echo "friday";;
117
# 6) echo "saturday";;
118
# 7) echo "sunday";;
119
# *) echo "wrong input";;
120
# esac
121
# print no. from 1 to 10
122
# print the multiplication table of a given no.
123
# write a program to check a no. is palindrom or not
124
# write a program to compute m^n
125
# write a program to read student name roll no. in the same line and then write the line to a file student.txt it then prompts you for more entries
126
# i=1
127
# while [ $i -le 10 ]
128
# do
129
# echo "$i"
130
# i=`expr $i + 1`
131
# done
132
# read a
133
# i=1
134
# while [ $i -le 10 ]
135
# do
136
# f=`expr $a \* $i`
137
# echo "$f"
138
# i=`expr $i + 1`
139
# done
140
# read a
141
# o=$a
142
# sum=0
143
# while [ $a -gt 0 ]
144
# do
145
# r=`expr $a % 10 `
146
# sum=`expr $sum \* 10 + $r `
147
# a=`expr $a / 10 `
148
# done
149
# if [ $o -eq $sum ]
150
# then
151
# echo "palindrom"
152
# else
153
# echo "not palindrom"
154
# fi
155
# read a
156
# read b
157
# x=1
158
# while [ $b -gt 0 ]
159
# do
160
# x=`expr $x \* $a `
161
# b=`expr $b - 1 `
162
# done
163
# echo "$x"
164
165
# echo "enter details"
166
# read input
167
# while [ "$input" != quit ]
168
# do
169
# echo "$input" >> student.txt
170
# read input
171
# done
172
# echo "finish"
173
filename="bash.string.txt"
174
echo ${filename%.*}
175
echo ${filename#*.}
176
177
178
179
180
181
182
183
184
185
186
187