#!/bin/bash
#
location=$HOME
filen="sentinel"
#
if [ -e $location ]
then
echo "Ok on the $location directory"
echo "Now checking on the file, $filen"
#
if [ -e $location/$filen ]
then
echo "OK on the filename"
echo "Updating Current Date..."
date >> $location/$filen
#
else
echo "File does not exist"
echo "Nothing to update"
fi
#
else
echo "The $location directory does not exist"
echo "Nothing to update"
fi
Monday, February 27, 2017
Bash Script: Check if user is on system
#!/bin/bash
function usersys {
if grep $USERN /etc/passwd
then
echo "$USERN is in system."
exit 0
#
else
echo "$USERN is not in system."
exit 0
fi
}
#
function usr {
read -p "Enter username:" USERN
if test $USERN
then
echo "Username: $USERN"
usersys
#
else
echo "You did not enter a username. Enter Username"
usr
fi
}
usr
function usersys {
if grep $USERN /etc/passwd
then
echo "$USERN is in system."
exit 0
#
else
echo "$USERN is not in system."
exit 0
fi
}
#
function usr {
read -p "Enter username:" USERN
if test $USERN
then
echo "Username: $USERN"
usersys
#
else
echo "You did not enter a username. Enter Username"
usr
fi
}
usr
Thursday, February 16, 2017
LX0-104: Chapters Reviews and Exercises
LX0-104
Chapters Reviews Exercises
2 57 2-7, 2-8
4 114 x
5 157 x
7 232 7-1
9 334 9-1, 9-2
13 492 13-2
14 529 14-2
15 579 15-1, 15-2
16 630 16-1, 16-2, 16-3
17 689 17-1, 17-2, 17-3
18 734 18-1, 18-2, 18-3, 18-4
Subscribe to:
Comments (Atom)