Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a02ec4e

Browse files
author
Lisheng2016
committed
sourcing utility
1 parent 1f66f2a commit a02ec4e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

functions.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#! /bin/bash
2+
3+
# This is a function file for main.sh
4+
5+
function calc {
6+
result=$(expr $1 + $2)
7+
}
8+

main.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#! /bin/bash
2+
var1=1
3+
var2=2
4+
5+
source functions.sh
6+
# sourcing function files
7+
8+
calc $var1 $var2
9+
echo $result

0 commit comments

Comments
 (0)