Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Exec command with mutt - turn on & off? Post 302993229 by Don Cragun on Tuesday 7th of March 2017 08:28:01 PM
Old 03-07-2017
I'm not sure why you're asking about exec, but there are definitely other problems in your script.

An exec command will not affect a pipeline whose first process is not reading anything from standard input and whose last process is not writing anything to standard output. If your pipeline writes to standard error, those messages will be written to the file specified by your exec command. If that isn't what you want to happen, you'll need to change something to make it do what you do want; but since you have given us no indication of what you want to happen, there is no way we can guess if your use of exec is right or wrong.

Expanding variables that have been set to empty strings (or to strings containing whitespace characters) without quoting them is a disaster waiting to happen. You have dozens of those.

Every time you execute a command (such as the command [ $? -eq x ] where x is some digit) resets the value of $?. So, only your first test of $? is testing the exit status of your dotting the /u02/EssbaseServer/essbaseserver1/bin/startMaxl.sh command. Presumably, you need something more like:
Code:
. "${_STARTMAXL}" "${_MAINPATH}${_MAXLPATH}All_Data_Export.mxl" "${_ESSB_USER}" "${_ESSB_PSWD}" "${_ESSB_SRVR}" "${_ESSB_APP}" "${_ESSB_DB}" "${_DATA_EXPORTPATH}" "${_EXPORTTYPE}" "${_YEAR}${_MONTH}${_DAY}" "${_MLF}"
ret_val=$?

if [ $ret_val -eq 1 ]

and use $ret_val in all of your following tests instead of $?.
 

10 More Discussions You Might Find Interesting

1. Red Hat

/usr/bin/find && -exec /bin/rm never work as expected

hi there, Would you able to advise that why the syntax or statement below couldn't work as expected ? /usr/bin/find /backup -name "*tar*" -mtime +2 -exec /bin/rm -f {} \; 1> /dev/null 2>&1 In fact, I was initially located it as in crontab job, but it doesn't work at all. So, I was... (9 Replies)
Discussion started by: rauphelhunter
9 Replies

2. AIX

Using mutt from command line or script

Hello, I am attempting to send emails from AIX 5.2 using either the mailx command or mutt. When I use mutt: mutt -a jim.txt -s "Test Email" me@mydomain.com It sends the attachment, but it forces me into the interactive menu. When I use mailx: cat data.txt | uuencode... (10 Replies)
Discussion started by: jyoung
10 Replies

3. UNIX for Advanced & Expert Users

HTML and attachment using mutt command

Hi All, I want to attach the file as well send html content in the mail body using mutt command or any other command.(uuencode is not present). Please help me. Thanks in advance (1 Reply)
Discussion started by: arukuku
1 Replies

4. UNIX for Advanced & Expert Users

Mutt for html body and multiple html & pdf attachments

Hi all: Been racking my brain on this for the last couple of days and what has been most frustrating is that this is the last piece I need to complete a project. There are numerous posts discussing mutt in this forum and others but I have been unable to find similar issues. Running with... (1 Reply)
Discussion started by: raggmopp
1 Replies

5. UNIX for Dummies Questions & Answers

Mutt command - email body with out file name

Hello All, I know we can put body inside a mail using -i option for specifying the file which contains body message, is there an option for me to specify body content instead of a file specification only using mutt? Below is not working and i don't see any options in manual page! ... (4 Replies)
Discussion started by: Ariean
4 Replies

6. Linux

Cannot boot as usuall , turn to black screen & ask for loging in ???? Help me????

Hey guys..... Im new user for linux fedora 20.... i really need help ....... i have no idea why suddently when i turn on my laptop fedora turn to be black screen and ask me loging in , when i loging then nothing happen , it stay at the same screen... then i try to go to "with linux secure...,"... (12 Replies)
Discussion started by: asianfootball
12 Replies

7. Shell Programming and Scripting

Mutt command error

Hello there, I am using "mutt" command to send e-mails. mutt -s "Mail subject line" $( printf -- '-a attachment_name') < "mail body file" "e-mail id" I wish to change the name of the attachment by appending the date to it. Something like "attachment_name_$DATE.html" in the mutt... (5 Replies)
Discussion started by: H squared
5 Replies

8. UNIX for Beginners Questions & Answers

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... (5 Replies)
Discussion started by: SIMMS7400
5 Replies

9. Shell Programming and Scripting

How to send the log as it is through mailx or mutt command?

Hi, I am able to send the mail with attachment through mailx/mutt command.But i am seeing the log file statements all together when i tried to open from my outlook. log file have the details like below aaa bbb ccc when i tried to open it from my outlook after receiving the mail attachment... (1 Reply)
Discussion started by: Samah
1 Replies

10. Shell Programming and Scripting

Mutt command email body

Hi Team, While sending the email using the mutt command, mail body not appearing properly and attachment it is showing without line breaks and i used the CSS Style (nowrapper )it is working fine. in this case how to handle the email body, please help me. (1 Reply)
Discussion started by: bmk123
1 Replies
exec(1)                                                            User Commands                                                           exec(1)

NAME
exec, eval, source - shell built-in functions to execute other commands SYNOPSIS
sh exec [argument...] eval [argument...] csh exec command eval argument... source [-h] name ksh *exec [arg...] *eval [arg...] DESCRIPTION
sh The exec command specified by the arguments is executed in place of this shell without creating a new process. Input/output arguments may appear and, if no other arguments are given, cause the shell input/output to be modified. The arguments to the eval built-in are read as input to the shell and the resulting command(s) executed. csh exec executes command in place of the current shell, which terminates. eval reads its arguments as input to the shell and executes the resulting command(s). This is usually used to execute commands generated as the result of command or variable substitution. source reads commands from name. source commands may be nested, but if they are nested too deeply the shell may run out of file descrip- tors. An error in a sourced file at any level terminates all nested source commands. -h Place commands from the file name on the history list without executing them. ksh With the exec built-in, if arg is given, the command specified by the arguments is executed in place of this shell without creating a new process. Input/output arguments may appear and affect the current process. If no arguments are given the effect of this command is to mod- ify file descriptors as prescribed by the input/output redirection list. In this case, any file descriptor numbers greater than 2 that are opened with this mechanism are closed when invoking another program. The arguments to eval are read as input to the shell and the resulting command(s) executed. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. EXIT STATUS
For ksh: If command is not found, the exit status is 127. If command is found, but is not an executable utility, the exit status is 126. If a redi- rection error occurs, the shell exits with a value in the range 1-125. Otherwise, exec returns a zero exit status. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), ksh(1), sh(1), attributes(5) SunOS 5.10 17 Jul 2002 exec(1)
All times are GMT -4. The time now is 08:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy