Wednesday, May 25, 2011

Advanced Shell

cp -Rfv /etc ./etc

vim Security.sh

#!/bin/bash

if [ -f "/etc/passwd" ] ; then
echo "passwd file exists"
grep -n -v -f "./etc/passwd" "/etc/passwd"
else
echo "passwd file does not exist"
fi

if [ -f "/etc/group" ] ; then
echo "group file exists"
grep -n -v -f "./etc/group" "/etc/group"
else
echo "group file does not exist"
fi

exit 0

i to edit esc hold shift ZZ to save and exit

to exit without saving hit the esc key then :q! enter

chmod +x Security.sh
./Security

You must have 4 files checked in order to get credit for this assignment. I only do 2 in this example.

No comments: