1.echofile.sh
#! /bin/bash
File=passwd
{
read line1
read line2
} < $File
echo "First line in $File is:"
echo "$line1"
echo
echo "Second line in $File is:"
echo "$line2"
exit 0
2.
#! /bin/bash
# rpm file check
SUCCESS=0
E_NOARGS=65
if [ -z "$1" ]; then
echo "Usage: `basename $0` rpm-file"
exit $E_NOARGS
fi
{
echo
echo "Archive Description:"
rpm-qpi $1
echo
echo "Archive Listing:"
rpm-qpl $1
echo
rpm -i --test $1
if [ "$?" -eq $SUCCESS ]; then
echo "$1 can be installed"
else
echo "$1 cannot be installed."
fi
echo
} > "$1.test"
echo "Results of rpm test in file $1.test"
exit 0