Finding error code


 
Thread Tools Search this Thread
Operating Systems Solaris Finding error code
# 1  
Old 07-14-2006
Finding error code

Hi Guys,
Can you tell me how to find error code generated by a command.
Say i run a command and its generating an error how do i find out its error code ( i know its done using redirection operator.......but not sure how)?
# 2  
Old 07-15-2006
The "$?" variable is equal to the error return of the previous program. You can remember this variable, print it out, or perform different actions based on various errors. You can use this to pass information back to the calling shell by exiting a shell script with the number as an argument. Example:
Code:
#!/bin/sh
# this is script1
exit 12

Then the following script
Code:
#!/bin/sh
script1
echo $?

would print 12.
# 3  
Old 07-15-2006
Bug

Thanks a lot man.
Thanks for your help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Challenge in finding listing class method and its number of code lines

there are about 300 objectivec .m files and I need to print each file name and its method and number of lines inside the method there is a sample perl files that do perl brace matching... (0 Replies)
Discussion started by: steve32001
0 Replies

2. Shell Programming and Scripting

Finding only one error in a row

I am using below code to validate whether datatype,length and date format is correct as defined in file_layout. Below code is able to find only one error in a row,if there is more than one error in a same row then code is not able to highlight second error. How to customize the below code to... (8 Replies)
Discussion started by: srivalli
8 Replies

3. UNIX for Dummies Questions & Answers

Finding return code for completed process ??

I have Process Id for one background process and currently it is running state. I want to see the return code after the above running process is done. for the forground process normally I use "echo $?". But how to get the return code for my background process on UNIX/Linux?? Thanks in... (5 Replies)
Discussion started by: sriraman2
5 Replies

4. UNIX for Dummies Questions & Answers

Finding implementation code in UNIX for FAT16/32

So we know that Unix is free source software. And we know that Unix have support for FAT 16 and FAT 32. Does anyone know where can I found that implementation in code ? Thank you. (2 Replies)
Discussion started by: medolina
2 Replies

5. Shell Programming and Scripting

Error in finding the PID by grep and assigning to a variable

Hello All, I am facing difficulty in getting the PID value & then assigning it to a variable, kindly help me in resolving the issue. Thanks a lot in advance. The custom utility used inside the Test2.sh will process the file in a batch of 10 lines at once and for efficient memory management,... (3 Replies)
Discussion started by: duddukuri
3 Replies

6. Shell Programming and Scripting

AWK code for finding distances between atoms in two different files

Hi:) I have two separate data files (.xyz) type and I want to see distances between the coordinates of atoms of the two files. For example:- My first files contains 1 1 1 11.50910000 5.17730000 16.49360000 3 1 2 11.21790000 6.36062000 15.60660000 6 1 2 ... (4 Replies)
Discussion started by: ananyob
4 Replies

7. AIX

aix 4.2: finding out the return code of a savevg/mksysb ?

Am I right to assume that to check the return code of a savevg/mksysb on an AIX 4.2 is with the "$?" ? (1 Reply)
Discussion started by: Browser_ice
1 Replies

8. Shell Programming and Scripting

script for finding an error from a log file

Hi , I have a doubt about a shell script to find an ERROR from the log file. But I need to specify a the scan from a particular date and time in the log. Till now I have developed the following script. Please suggest what shall I add in this for date and time. If the script finds a particular... (5 Replies)
Discussion started by: himvat
5 Replies

9. UNIX for Advanced & Expert Users

Finding alternative code

Hi Sir's I've the below piece of code has the following functionalities: 1) Read the "pcp" file and create Job related parameter file "$PARMFILE". $PARMFILE has below variables: AFTD2010 "FILE_TYPE_D=Y export FILE_TYPE_D" AFTD2010 "FILE_TYPE_I=N export FILE_TYPE_I" AFTD2010... (0 Replies)
Discussion started by: Lokesha
0 Replies

10. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies
Login or Register to Ask a Question