Sponsored Content
Top Forums Shell Programming and Scripting Exit code from piping in unix shell script Post 302653023 by sonu_pal on Friday 8th of June 2012 09:26:23 AM
Old 06-08-2012
Yes it need the pipeline ,because it is making our process faster,

We are basically looking for error exit status after each command . Actually when we are running the script our job is not capturing the failed exit status code after each command. while running whole of the process and it is giving status exit code 0

For example I have changed the setting file '

tranfrmr_p6.stx' and there is some syntax error or suppose i have changed the input file name in the file
than process should get exited with error code,but successor get run.

Please find the snapshot shot of log when the process is running .

Quote:
STEP : p6_tranfrmr_log.txt
--------------------------------------
Fri Jun 8 06:23:29 2012 - Opening Transformer process.


----------------------------------------
STEP : p7_srtforrl_log.txt
--------------------------------------
Fri Jun 8 06:23:29 2012 - Opening TSQSORT process.
Fri Jun 8 06:23:34 2012 - Closing TSQSORT process.

--------------------------------------------
In above case STEP :P6 is not able to process the input file so it skipped and moved the next sucessor process
STEP : p7_srtforrl

Also please find the content of the setting file (tranfrmr_p6.stx) .
Please find top and last content as it is a very long xml code
Quote:
<CATEGORY>

<INPUT>
<PARAMETER>
<INPUT_SETTINGS>
<ARGUMENTS>
<ENTRY>
<ENTRY_ID>1</ENTRY_ID>
<FILE_QUALIFIER>us_winkey_p6</FILE_QUALIFIER>
<DATA_FILE_NAME>stdin</DATA_FILE_NAME>
<DDL_FILE_NAME>$(DDL)/us_winkey_p5.ddx</DDL_FILE_NAME>
<FILE_DELIMITER/>
<USE_QUOTES_AS_QUALIFIER/>

/ ** Long XML code */

</OUTPUT>
<PROCESS>
<PARAMETER>
<PROCESS_SETTINGS>
<ARGUMENTS>
<PROCESS_LOG_FILE_NAME>$(LOGS)/p6_tranfrmr_log.txt</PROCESS_LOG_FILE_NAME>
<ENABLE_DEBUG_OUTPUT>0</ENABLE_DEBUG_OUTPUT>
<DEBUG_FILE_NAME>$(DEBUG)/p6_tranfrmr_debug.txt</DEBUG_FILE_NAME>
<MASK_FILE_NAME>$(GENERAL_RESOURCES)/maskfile$(PLAFEXT)</MASK_FILE_NAME>
<STRSUB_TABLE_FILE_NAME>$(GENERAL_RESOURCES)/strsub$(PLAFEXT)</STRSUB_TABLE_FILE_NAME>
</ARGUMENTS>
</PROCESS_SETTINGS>
</PARAMETER>
</PROCESS>
<STATISTICS>
<PARAMETER>
<STATISTICS_SETTINGS>
<ARGUMENTS>
<STATS_FILE_NAME>$(STATS)/p6_tranfrmr_stats.txt</STATS_FILE_NAME>
</ARGUMENTS>
</STATISTICS_SETTINGS>
</PARAMETER>
</STATISTICS>
</CATEGORY>

</TRANFRMR>
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

exit a shell script!!

could somebody tell me please how to exit a shell script: if then echo "No arguments detected" exit 1 fi ... echo "still there" # is displayed .. :-( (4 Replies)
Discussion started by: sami98
4 Replies

2. Programming

exit status running java classpath in unix shell

I have a java classpath running inside of a unix shell script. During my testing it will error with lines that show an example like this below. java.io.FileNotFoundException error at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:129), ... (2 Replies)
Discussion started by: mmcds
2 Replies

3. Shell Programming and Scripting

problem with exit code when piping

i am writing a script to perform some mysqldumps and gzip them. The problem I am running into is that if the user specifies a database that doesn't exist, the error the mysql engine produces is still piped into gzip, and the exit code returned is 0. If I don't pipe into gzip, an exit code... (4 Replies)
Discussion started by: bitoffish
4 Replies

4. Shell Programming and Scripting

exit shell from a script

hi guys I have a script that I need to terminate or exit the shell or session completely for the user but the exit only exit from the script and takes the user to the shell I found this https://www.unix.com/unix-dummies-questions-answers/399-using-exit-command-shell-script.html saying that... (1 Reply)
Discussion started by: kopper
1 Replies

5. Shell Programming and Scripting

How to exit a shell script if a unix command does not return any value for 10 seconds?

Hi, Can anyone help me how to exit a shell script if a unix command inside does not return any value for 10 seconds? The scenarios is like this. I want to login to a application using shell script where the connection string is mentioned.but suppose this connection string is not... (10 Replies)
Discussion started by: arijitsaha
10 Replies

6. Shell Programming and Scripting

How to capture exit code of child script and send it to parent script?

#!/usr/local/bin/bash set -vx /prod/HotelierLinks/palaceLink/bin/PalacefilesWait /prod/HotelierLinks/palaceLink/bin/prodEnvSetup 03212013 & if then echo "fatal error: Palace/HardRock failed!!!!" 1>&2 echo "Palace Failed" | mail -s "Link Failed at Palace/HardRock" -c... (1 Reply)
Discussion started by: aroragaurav.84
1 Replies

7. Shell Programming and Scripting

How to capture the exit code of a shell script in a perl script.?

hi, i want to pop up an alert box using perl script. my requirement is. i am using a html page which calls a perl script. this perl script calls a shell script.. after the shell script ends its execution, i am using exit 0 to terminate the shell script successfully and exit 1 to terminate the... (3 Replies)
Discussion started by: Little
3 Replies

8. Shell Programming and Scripting

Exit the shell script

Hi, suppose my script is sample.sh i have to run using '. ./sample.sh' as . ./script file always executes the script in my parent shell. when my sample.sh contains exit command .. my environment is getting closed as am executing in the parent shell ... please suggest me how can i use... (5 Replies)
Discussion started by: pracheth
5 Replies

9. UNIX for Dummies Questions & Answers

UNIX exit code 11

We have a batch Unix process that runs during the day and it is getting an exit code 11 from Unix. It finishes a sqlplus step and gets the exit code 11 before it starts the next step. This used to happen once a year and now is happening more often (but not every time the process runs). We have... (2 Replies)
Discussion started by: msol
2 Replies

10. Shell Programming and Scripting

Exit code 267 from shell script

Hi, We have a problem in Linux (GNU/Linux 3.10.0-693.1.1.el7.x86_64) with a shell script returning 267 as return code. The script, load_flag.sh is called from main_script.sh (both script samples given below). The exit code from load_flag.sh is used to decide whether to continue execution of... (1 Reply)
Discussion started by: Arunnath
1 Replies
unix2dos(1)						      General Commands Manual						       unix2dos(1)

NAME
unix2dos - UNIX to DOS text file format converter SYNOPSYS
unix2dos [options] [-c convmode] [-o file ...] [-n infile outfile ...] Options: [-hkqV] [--help] [--keepdate] [--quiet] [--version] DESCRIPTION
This manual page documents unix2dos, the program that converts text files in UNIX format to DOS format. OPTIONS
The following options are available: -h --help Print online help. -k --keepdate Keep the date stamp of output file same as input file. -q --quiet Quiet mode. Suppress all warning and messages. -V --version Prints version information. -c --convmode convmode Sets conversion mode. Simulates unix2dos under SunOS. -o --oldfile file ... Old file mode. Convert the file and write output to it. The program default to run in this mode. Wildcard names may be used. -n --newfile infile outfile ... New file mode. Convert the infile and write output to outfile. File names must be given in pairs and wildcard names should NOT be used or you WILL lost your files. EXAMPLES
Get input from stdin and write output to stdout. unix2dos Convert and replace a.txt. Convert and replace b.txt. unix2dos a.txt b.txt unix2dos -o a.txt b.txt Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode. unix2dos a.txt -c iso b.txt unix2dos -c ascii a.txt -c iso b.txt Convert and replace a.txt while keeping original date stamp. unix2dos -k a.txt unix2dos -k -o a.txt Convert a.txt and write to e.txt. unix2dos -n a.txt e.txt Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt. unix2dos -k -n a.txt e.txt Convert and replace a.txt. Convert b.txt and write to e.txt. unix2dos a.txt -n b.txt e.txt unix2dos -o a.txt -n b.txt e.txt Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt. Convert d.txt and write to f.txt. unix2dos -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt DIAGNOSTICS
BUGS
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me. AUTHOR
Benjamin Lin - ( blin@socs.uts.edu.au ) MISCELLANY
Tested environment: Linux 1.2.0 with GNU C 2.5.8 SunOS 4.1.3 with GNU C 2.6.3 MS-DOS 6.20 with Borland C++ 4.02 Suggestions and bug reports are welcome. SEE ALSO
dos2unix(1) 1995.03.31 unix2dos v2.2 unix2dos(1)
All times are GMT -4. The time now is 06:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy