Added support for middle name
Added support for more than FirstName LastName (e.g. John William Smith)
This commit is contained in:
@@ -5,63 +5,59 @@
|
|||||||
# Usage: uapay.sh FirstName LastName
|
# Usage: uapay.sh FirstName LastName
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
# Check to see if BASH is installed
|
# BASH present?
|
||||||
{
|
|
||||||
if [ ! -f /bin/bash ]; then
|
if [ ! -f /bin/bash ]; then
|
||||||
echo "Bash not found!"
|
echo "Bash not found!"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
# Check to see if CURL is installed
|
# CURL present?
|
||||||
{
|
|
||||||
if [ ! -f /usr/bin/curl ]; then
|
if [ ! -f /usr/bin/curl ]; then
|
||||||
echo "Curl not found!"
|
echo "Curl not found!"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
# Check to see if GREP is intalled
|
# GREP present?
|
||||||
{
|
|
||||||
if [ ! -f /usr/bin/grep ]; then
|
if [ ! -f /usr/bin/grep ]; then
|
||||||
echo "Grep not found!"
|
echo "Grep not found!"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
# URL for UA Salaries
|
# UA Payroll URL
|
||||||
uapay_url='https://openpayrolls.com/employee'
|
uapay_url='https://openpayrolls.com/employee'
|
||||||
|
|
||||||
# User Agent
|
# User Agent
|
||||||
uapay_useragent='Chrome/79'
|
uapay_useragent='Chrome/79'
|
||||||
|
|
||||||
# Get Input from User
|
# Get Input
|
||||||
{
|
|
||||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||||
echo -e "\nUsage: uapay.sh FirstName LastName\n"
|
echo -e "\nUsage: uapay.sh FirstName LastName\n"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
uapay_name=$1-$2
|
for i in "$@"
|
||||||
|
do
|
||||||
|
uapay_name="$@"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
# Format Input
|
||||||
|
uapay_formatted_name=${uapay_name// /-}-4329
|
||||||
|
|
||||||
# Grep Filter
|
# Grep Filter
|
||||||
uapay_filter="and a pay of"
|
uapay_filter="and a pay of"
|
||||||
|
|
||||||
# Query URL
|
# Query URL
|
||||||
uapay_output=$(curl -s -k --user-agent $uapay_useragent $uapay_url/$uapay_name-4329 | grep "$uapay_filter")
|
uapay_query=$(curl -s -k --user-agent $uapay_useragent $uapay_url/$uapay_formatted_name | grep "$uapay_filter")
|
||||||
|
|
||||||
# Check output
|
# Check Results
|
||||||
{
|
if [ -z "$uapay_query" ]; then
|
||||||
if [ -z "$uapay_output" ]; then
|
echo -e "\n$uapay_name was not found.\n"
|
||||||
echo -e "\n$1 $2 was not found.\n"
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
# Format output
|
# Format Output
|
||||||
uapay_output=${uapay_output/\<p class=\"lead font-16 font-weight-400\"\>/}
|
uapay_query=${uapay_query/\<p class=\"lead font-16 font-weight-400\"\>/}
|
||||||
uapay_output=${uapay_output/\<\/p\>/}
|
uapay_query=${uapay_query/\<\/p\>/}
|
||||||
|
|
||||||
# Print output
|
# Print Output
|
||||||
echo -e "\n$uapay_output\n"
|
echo -e "\n$uapay_query\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user