Saturday, June 30, 2018

Zip some files and put the zip file in a fixed folder automatically using shell script,Linux Teacher Sourav,Kolkata 09748184075

#!/bin/sh
#
# 01/07/2018
#

FN="/home/sourav/Desktop/shell scripts/work1.zip"
cd /tmp
mkdir work 2>/dev/null # suppress message if directory already exists
cd work
#cp /etc/motd .
cat /var/run/motd.dynamic > motd
cp /etc/issue .
ls -la /tmp > tmp.txt
ls -la /usr > usr.txt
rm "$FN" 2>/dev/null # remove any previous file
zip "$FN" *
echo File "$FN" created. # cp to an external drive, and/or scp to another computer
echo "End of automatic zipping using shell script"
exit 0

No comments:

Post a Comment