Update and rename 1function.sh to function.sh

This commit is contained in:
Ankam Ravi Kumar
2024-09-21 00:44:20 +05:30
committed by GitHub
parent fc1581324b
commit 1d5a7e9452

27
function.sh Normal file
View File

@ -0,0 +1,27 @@
#!/bin/bash
#Purpose: Function example. Taking Backup of Particular File
#Version:1.0
#Created Date: 2024 Sep 21
#Modified Date:
#WebSite: https://arkit.co.in
#Author: Ankam Ravi Kumar
# START #
function takebackup (){
if [ -f $1 ]; then
BACKUP="/home/aravi/$(basename ${1}).$(date +%F).$$"
echo "Backing up $1 to ${BACKUP}"
cp $1 $BACKUP
fi
}
takebackup /etc/hosts
if [ $? -eq 0 ]; then
echo "BAckup Success"
fi
function testing (){
echo "Just TEsting Function"
}
testing
# END #