Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Turn off exec 2>${_ERRORFILE} > ${_LOGFILE} feature? Post 302992974 by SIMMS7400 on Saturday 4th of March 2017 08:00:15 AM
Old 03-04-2017
Turn off exec 2>${_ERRORFILE} > ${_LOGFILE} feature?

Hi Folks -

To make a long story short, this script is loaded into a workbench, executed via workbench user interface, and then I need to display the output on screen. However, I'm using the functions to direct stdout and stderror to their respective directories.

Is there a way to turn that off so I can leverage the cat command? Else, when I place my cat commands just prior to the exits, it doesn't work.

Here is my script:

Code:
#!/bin/bash
#::------------------------------------------------------------------------
#::-- Script Name: FDMEE_Act_Load.sh
#::  
#::-- Description: This Script Executes the FDMEE RunBatch Utility
#::                
#::-- Paramaters:  Call setenv.sh to determine the following:
#::                 1. Login
#::                 2. Password
#::                 3. Server
#::                 4. Application
#::                 5. Database
#::                 6. etc
#::      
#::-- Author:        
#::-- Date:            
#:: ------------------------------------------------------------------------
source /app/hyp_app/scripts/setenv.sh

#::-- Set Script Name --::#
_SN=${0##*/}

echo Script Name: ${_SN}
#::-- Script Name w/o EXT: ${_SN%%.sh*} --::#

#::-- Set Log & Error Files --::#
_INTRA_PATH=${_FDMEE_LOG_DIR}
_ERROR_INTRA_PATH=${_FDMEE_ERROR_DIR}

_LOGFILE=${_INTRA_PATH}/${_DATETIMESTAMP}_${_SN%%.sh*}.log
_ERRORFILE=${_ERROR_INTRA_PATH}/${_DATETIMESTAMP}_${_SN%%.sh*}.err
    echo ${_LOGFILE}

#::-- Direct STDOUT and STDERROR to repositories --::# 
exec 2>${_ERRORFILE} > ${_LOGFILE}

#::-- Begin Script Processing --::#
echo ------------------------------------------
echo ${_SN} Starting at ${_TIME}                      
echo ------------------------------------------
echo ------------------------------------------
echo Execute FDMEE Actuals Load           
echo ------------------------------------------
 
. ${_FDMEE_UTIL_DIR}/runbatch.sh $APPID -f:${_FDMEE_APP_PSWRD} ${_FDMEE_BATCH}

if [ $? -eq 0 ]
then
    echo ------------------------------------------
    echo ${_SN%%.sh*} - Completed Successfully           
    echo ------------------------------------------
    echo ------------------------------------------
    echo Script Process Exiting Normally          
    echo ------------------------------------------
  exit 0
else
    echo ------------------------------------------
    echo ${_SN%%.sh*} - Completed Unsuccessfully           
    echo ------------------------------------------
    echo ------------------------------------------
    echo Script Process Exiting Abnormally          
    echo ------------------------------------------
  exit 1
fi

Thank you!
 

6 More Discussions You Might Find Interesting

1. SCO

BASH-like feature. is possible ?

Greetings... i was wondering if there is any shell configuration or third party application that enables the command history by pressing keyboard up arrow, like GNU/BASH does or are there an SCO compatible bash versio to download? where ? just wondering (sory my stinky english) (2 Replies)
Discussion started by: nEuRoMaNcEr
2 Replies

2. UNIX for Dummies Questions & Answers

How to turn off duplex

I am using digital Unix and lpd. I have HP 4200n LaserJet TCP printer, but when I use lpr command, it always print duplex. I can turn off duplex feature at the panel of the printer, but then other Windows computer cannot print duplex. How can I set up /etc/printcap file so that it will be... (2 Replies)
Discussion started by: hiepng
2 Replies

3. UNIX for Dummies Questions & Answers

turn off sound

how to disable anoying beep sound??? (4 Replies)
Discussion started by: nnn
4 Replies

4. Shell Programming and Scripting

Script Variables Inquiry, Values Okay in Standalone Exec, No-Show in Cron Exec

I have the following bash script lines in a file named test.sh. #!/bin/bash # # Write Date to cron.log # echo "Begin SSI Load $(date +%d%b%y_%T)" # # Get the latest rates file for processing. # d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1) filename=$d export filename... (3 Replies)
Discussion started by: ginowms
3 Replies

5. UNIX for Beginners Questions & Answers

Exec command with mutt - turn on & off?

Hi Folks - Quick question around the exec command again. At the end of my script, I check for specific error codes that are returned from a process I execute within the shell script. Based on the error code, I send an email. Do I need to turn off exec feature prior to send each email so... (5 Replies)
Discussion started by: SIMMS7400
5 Replies

6. UNIX for Beginners Questions & Answers

Just can't turn off ipv6?

I'm running a Linux OS that uses Debian as it's base. A commercial vpn is installed that uses OpenVPN. For some reason, I can't get ipv6 to tunnel properly .... and Ipleak.net shows that my location is being unmasked by ipv6. I've tried kernel commands at boot, I've tried sysctl.conf commands.... (2 Replies)
Discussion started by: benc
2 Replies
script(1)							   User Commands							 script(1)

NAME
script - make record of a terminal session SYNOPSIS
script [-a] [filename] DESCRIPTION
The script utility makes a record of everything printed on your screen. The record is written to filename. If no file name is given, the record is saved in the file typescript. See WARNINGS. The script command forks and creates a sub-shell, according to the value of $SHELL, and records the text from this session. The script ends when the forked shell exits or when Control-d is typed. OPTIONS
The following option is supported: -a Appends the session record to filename, rather than overwriting it. NOTES
script places everything that appears on the screen in filename, including prompts. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) WARNINGS
script can pose a security risk when used in directories that are writable by other users (for example, /tmp), especially when run by a privileged user, that is, root. Be sure that typescript is not a link before running script. SunOS 5.11 30 Jan 2004 script(1)
All times are GMT -4. The time now is 11:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy