Reputation: 471
#Note: If you see # in front of any line it means that it’s a comment line not the actual code
#** ********************************************************************
FILE_NAME=filename_4.zip
FILE_LOCATION=/home/testvis/generic
ENTITY_LIST=ALL
if ${JAVACMD} -classpath $CLASSPATH:$LIB oracle.ucm.idcws.client.UploadTool \
--url=https://URL_XX/idcws/GenericSoapPort \
then
echo “File Successfully Uploaded”
else
echo “Exception Uploaded ”
exit 0
fi
This is returning the echo section correctly. But i want the error message which we get in the exception also should be echoed.
Like in PLSQL we have SQLERRM
. Do we have a similar variable or any method in shell script ?
Upvotes: 0
Views: 2487
Reputation: 82
You can use stderr redirection :
command-name 2> stderr.txt
or redirect all of the output like this :
command1 > everything.txt 2>&1
Example:
if ${JAVACMD} -classpath $CLASSPATH:$LIB oracle.ucm.idcws.client.UploadTool \
--url=https://URL_XX/idcws/GenericSoapPort \
then
echo “File Successfully Uploaded”
else
echo “Exception Uploaded ”
echo $($COMMAND> everything.txt 2>&1)
exit 0
fi
Upvotes: 1