USEFULL LINK FOR LINUX
http://linuxcommand.org/lc3_writing_shell_scripts.php
$# Stores the number of command-line arguments that were passed to the shell program.
$? Stores the exit value of the last command that was executed.
$* is a string containing all arguments.
$1 is the first argument.
SSH FUNCTION
{
if [ ${DB_OS_TYPE} == "SunOS" ]; then
COMMAND='cat /etc/release | head -1'
DB_CPU_TEMP=`exec_over_ssh ${ORA_USER} ${ORA_HOST} ". /export/home/$ORA_USER/.profile > /dev/null;opatch lsinventory| grep -i 'DATABASE PATCH'| head -1"`
else
DB_CPU_TEMP=`exec_over_ssh ${ORA_USER} ${ORA_HOST} ". /home/$ORA_USER/.bash_profile > /dev/null;opatch lsinventory| grep -i 'DATABASE PATCH'| head -1"`
fi
exec_over_ssh()
{
USER=$1
HOST=$2
COMMAND=$3
OUTPUT=`ssh ${USER}@${HOST} ${COMMAND}`
echo ${OUTPUT}
}
###################created script by me#
#!/bin/bash
###set -x
user=$1
HOST=$2
COMMAND=$3
exec_ssh()
{
OUTPUT=`ssh ${user}@${HOST} ${COMMAND}`
echo ${OUTPUT}
}
if [ $# == 3 ]
then
exec_ssh
else
echo "enter correect parameter"
exit
fi
http://linuxcommand.org/lc3_writing_shell_scripts.php
$# Stores the number of command-line arguments that were passed to the shell program.
$? Stores the exit value of the last command that was executed.
$* is a string containing all arguments.
$1 is the first argument.
SSH FUNCTION
{
if [ ${DB_OS_TYPE} == "SunOS" ]; then
COMMAND='cat /etc/release | head -1'
DB_CPU_TEMP=`exec_over_ssh ${ORA_USER} ${ORA_HOST} ". /export/home/$ORA_USER/.profile > /dev/null;opatch lsinventory| grep -i 'DATABASE PATCH'| head -1"`
else
DB_CPU_TEMP=`exec_over_ssh ${ORA_USER} ${ORA_HOST} ". /home/$ORA_USER/.bash_profile > /dev/null;opatch lsinventory| grep -i 'DATABASE PATCH'| head -1"`
fi
exec_over_ssh()
{
USER=$1
HOST=$2
COMMAND=$3
OUTPUT=`ssh ${USER}@${HOST} ${COMMAND}`
echo ${OUTPUT}
}
###################created script by me#
#!/bin/bash
###set -x
user=$1
HOST=$2
COMMAND=$3
exec_ssh()
{
OUTPUT=`ssh ${user}@${HOST} ${COMMAND}`
echo ${OUTPUT}
}
if [ $# == 3 ]
then
exec_ssh
else
echo "enter correect parameter"
exit
fi