bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need help for bash function return value


From: Tinni
Subject: Need help for bash function return value
Date: Thu, 11 Oct 2012 20:01:40 -0700 (PDT)

Hi,

I am  very new to the shell scripting.. Need some pointers for getting the
return value in shell scripting.
The scripts are mentioned below:

I want the values (  db_host_user, db_host, ORACLE_SID)  should be returned
from the clonesel to test1.sh

If i set the  script inside  the test1.sh  as  

val=`ssh remoteserver '/bin/sh clonesel' `,    

then it is also not rot returning value.. 

Pl. advice  how can I get the values  in test1.sh.

Thanks in advance
-Tinni



-----------------------------------------------------------------------------------------------------
I have one script  as test1.sh. The script is as 

#!/bin/bash
ssh remoteserver '/bin/sh clonesel'


------------------------------------------------------------------------------------------------------
In the remote server , the script  clonesel is as follows:


#!/bin/bash

echo
echo -e "\e[1;31m\tSetup Oracle Environments \e[0m"
echo -e "\t--------------------------"
echo
echo
echo -en "\e[1;32m\tType DB OS User Name :\e[0m"
read db_host_user
echo
echo -en "\e[1;32m\tType Database Host Name :\e[0m"
read db_host
echo
echo -en "\e[1;32m\tType Database Name :\e[0m"
read ORACLE_SID

export ORACLE_SID
export ORACLE_HOME=`cat /var/opt/oracle/oratab  | grep -v "#" |grep
$ORACLE_SID | awk -F ":" '{print $2 }'`
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
sqlplus -s / as sysdba <<EOF > /tmp/1
set echo off
set head off
set pause off
select open_mode from v\$database;
EOF
db_s=`cat /tmp/1 |grep "."`
echo
echo -e "\e[1;33m\tDatabase Name Set to  : *** $ORACLE_SID *** \e[0m"
echo
echo -e "\e[1;33m\tDatabase Mode Set to  : *** $db_s *** \e[0m"
echo
echo -e "\e[1;34mPress Enter to Continue ......\e[0m"

exit  0

read dummy
----------------------------------------------------------------------------------------------
-- 
View this message in context: 
http://old.nabble.com/Need-help-for-bash-function-return-value-tp34545597p34545597.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]