#!/bin/bash
source /root/shashi/credentials.prop
env=$1
if [ "$env" = = '' ] || [ "$username" = = '' ] || [ "$password" = = '' ];then
echo "usuage ./build.sh"
exit
fi
source /root/shashi/properties
if [[ $codebasedir == '' ]]; then
echo -n "Please provide tpd all package file:"
read -s codebasedir
echo
fi
[ ! -d "log" ] && mkdir log
[ ! -d "$codebasedir" ] && echo code base dir not found.
##validation for curl installation
verify_curl()
{
which curl > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "curl is not installed"
exit
else
echo "curl version is : `curl --version | head -1 |cut -d" " -f1,2`"
fi
}
##first test that we have the correct password
verify_password()
{
for x in `cat /root/shashi/environment/"$env"`
source /root/shashi/credentials.prop
env=$1
if [ "$env" = = '' ] || [ "$username" = = '' ] || [ "$password" = = '' ];then
echo "usuage ./build.sh"
exit
fi
source /root/shashi/properties
if [[ $codebasedir == '' ]]; then
echo -n "Please provide tpd all package file:"
read -s codebasedir
echo
fi
[ ! -d "log" ] && mkdir log
[ ! -d "$codebasedir" ] && echo code base dir not found.
##validation for curl installation
verify_curl()
{
which curl > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "curl is not installed"
exit
else
echo "curl version is : `curl --version | head -1 |cut -d" " -f1,2`"
fi
}
##first test that we have the correct password
verify_password()
{
for x in `cat /root/shashi/environment/"$env"`
do
curl -s -f -k --user $username:$password $x/home/users/a/$username.json | grep -q 'rep'
if [ $? -eq 0 ]
then
echo "Username and Password is correct :$x"
else
echo "you don't have the correct username or password : $x"
exit
fi
done
}
check_app(){
if [ ${env} = = 'true' ] ; then
verify_curl
verify_password
fi
}
verify_curl
verify_password
check_app
===============================================================
#!/bin/bash
jail="${1:-/home/shashi}"
echo "set at ${jail}"
#!/bin/bash
var=${USER:-not_found}
=====================
#!/bin/bash
var=${USER:=value}
#!/bin/bash
var=${USER:value}
d=${var:=not_found}
sh -x script.sh
====================
#!/bin/bash
path=${1:?ERROR command line arg not passed}
echo "Backup path is $path."
echo "I m done if \$path is set."
./script.sh /home
curl -s -f -k --user $username:$password $x/home/users/a/$username.json | grep -q 'rep'
if [ $? -eq 0 ]
then
echo "Username and Password is correct :$x"
else
echo "you don't have the correct username or password : $x"
exit
fi
done
}
check_app(){
if [ ${env} = = 'true' ] ; then
verify_curl
verify_password
fi
}
verify_curl
verify_password
check_app
===============================================================
#!/bin/bash
jail="${1:-/home/shashi}"
echo "set at ${jail}"
#!/bin/bash
var=${USER:-not_found}
=====================
#!/bin/bash
var=${USER:=value}
#!/bin/bash
var=${USER:value}
d=${var:=not_found}
sh -x script.sh
====================
#!/bin/bash
path=${1:?ERROR command line arg not passed}
echo "Backup path is $path."
echo "I m done if \$path is set."
./script.sh /home