-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample-function.sh
executable file
·65 lines (64 loc) · 1.07 KB
/
sample-function.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
#2016-04-08
#
#
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#
function showe()
{
echo "hello, you are calling the function"
}
echo "first time call the function"
showe
echo "second time call the function"
showe
echo "--------------------"
#
function show() {
echo "hello, you are calling the function $1"
}
echo "first time call the function"
show first
echo "second time call the function"
show second
echo "++++++++++++********************"
#
function abc()
{
RESULT=`expr $1 \% 2`
if [ $RESULT -ne 0 ] ; then
return 0
else
return 1
fi
}
echo "Please enter a number who can devide by 2"
read N
abc $N
case $? in
0)
echo "yes , it is "
;;
1)
echo "no , it isn't"
;;
esac
echo "++++++++++++"
# multinest
function first()
{
function second()
{
function third()
{
echo "------this is third"
}
echo "------this is second"
third
}
echo "------this is the first"
second
}
echo "starting ......"
first