To resolve the environment variables (e.g. $XXX_TOP/test) passed as concurrent program argument to Host script
dirpath="$(echo $8)"eval cd "$dirpath"
echo pwd
or to resolve path using eval
dirpath="$(echo $8)"
dirpath1=$(eval echo $dirpath)
echo "dirpath --> $dirpath1"
Call Pl-Sql procedure from shell script with out variable
SQLVAR=`sqlplus -s $APPS_USER_ID <<ENDOFSQL
SET SERVEROUTPUT ON SIZE 1000000
whenever sqlerror exit 1;
declare
v_errorlog VARCHAR2(4000);
begin
pkg.prc(p_arg1 => $arg1, p_arg2 => $arg2, p_error_out => v_errorlog);
dbms_output.put_line('v_errorlog --> '||v_errorlog);
end;
/
exit;
ENDOFSQL`
echo " SQLVAR output is - $SQLVAR"
For only package call
SQLVAR=`sqlplus -s $APPS_USER_ID <<ENDOFSQL
set heading off newpage 0 pagesize 0;
exec pkg.prc(p_arg1 => $arg1, p_arg2 => $arg2);
exit;
ENDOFSQL`
echo " SQLVAR output is - $SQLVAR"
To Cut a string from the end by identifier
Cut string from the end by identifier "/" eg: /abc/def/fdf/abc.dat
OUTPUT='
/abc/def/fdf/abc.dat'
l1=$(echo $OUTPUT | awk -F"/" '{print length($0)-length($NF)}')
l2=`expr $l1 + 1`
echo "l2 $l2"
l3=$(echo $OUTPUT | wc -m)
echo "l3 $l3"
filename=$(echo $OUTPUT | cut -b $l2-$l3)
echo "filename --> $filename"