Skip to content

Commit 6e71b1f

Browse files
author
Ankam Ravi Kumar
authored
Create 1function.sh
1 parent 88c204a commit 6e71b1f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

1function.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
#Purpose: Function example. Taking Backup of Particular File
3+
#Version:1.0
4+
#Created Date: Sat May 26 00:27:50 IST 2018
5+
#Modified Date:
6+
#WebSite: https://arkit.co.in
7+
#Author: Ankam Ravi Kumar
8+
# START #
9+
function takebackup (){
10+
if [ -f $1 ]; then
11+
BACKUP="/home/aravi/$(basename ${1}).$(date +%F).$$"
12+
echo "Backing up $1 to ${BACKUP}"
13+
cp $1 $BACKUP
14+
fi
15+
}
16+
17+
takebackup /etc/hosts
18+
if [ $? -eq 0 ]; then
19+
echo "BAckup Success"
20+
fi
21+
function testing (){
22+
echo "Just TEsting Function"
23+
}
24+
25+
testing
26+
# END #

0 commit comments

Comments
 (0)