10-26-2005
Error Messages
I have got script like this
#!/bin/ksh -e
function errtrap {
es=$?
print "ERROR line $1: Command exited with status $es."
}
trap 'errtrap $LINENO' ERR
cp no_perm yes_perm
echo "error"
When I run the script I get a output like this.
**********************
cp: cannot access no_perm
ERROR line 7: Command exited with status 2.
***********************
I would like to catch the error message " cp: cannot access no_perm " and display that with the print statement rather send in a mail at that place .
Is there any variable like $? which catches a error message . Much like sqlerrm variable in oracle .
I have done man ksh and did not find any .
I am doing this in script so that I don't have a option like
cp no_perm yes_perm 2>file
and then grep the content of file . Again for some reason i can't do call a script like test.ksh 2>/dev/null
Thanks
Ashok
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Dear Guys ,
AM using linux R.H 6.1 , I configured sendmail , when i update the alias file , i keep getting the following message :
" Warning: .cf file is out of date: sendmail 8.11.6 supports version 9, .cf file is version 8 "
so what does it mean , even though .cf file is not empty or... (1 Reply)
Discussion started by: tamemi
1 Replies
2. UNIX for Advanced & Expert Users
Hi Experts,
I'm getting the following errors on /var/adm/messages file permanently.
Dec 28 10:19:38 ioocsrv1 bsd-gw: open(dfA415ioocsrv3): File exists
Dec 28 10:20:53 ioocsrv1 bsd-gw: open(dfA415ioocsrv3): File exists
Dec 28 10:22:08 ioocsrv1 bsd-gw: open(dfA415ioocsrv3): File exists
Dec... (1 Reply)
Discussion started by: nikk
1 Replies
3. UNIX for Advanced & Expert Users
Hi,
I have a SunFire V490, Solaris 10 with XP1024 storage and HP Library. I have noticed the following error messages in the /var/adm/messages file. These errors are being generated constantly. Also commands like devfsadm, format cfgadm etc are getting hung. After a reboot it works fine for a... (1 Reply)
Discussion started by: nitinp82
1 Replies
4. Solaris
dear all
i have the following error in messages in solaris server named devweb
does any one can help me about the error
the disk devapp connect by nfs to another server called devdb :
Oct 10 09:55:41 devweb nfs: WARNING: NFSMAPID_DOMAIN does not match the server: devdb domain.
Oct 10... (0 Replies)
Discussion started by: murad.jaber
0 Replies
5. Shell Programming and Scripting
Please see the below script-
ftp $FTPREMOTESERVER
prompt
mput $DATAPATH/*.dat
quit | ftp -in > FTPRETURNMSGLOGFILE # iam trying write the eroor messages inside a file when the ftp quits.
Based on the above script te ftp is properly working but writing into the file wen ftp quits is nor... (1 Reply)
Discussion started by: dineshr85
1 Replies
6. UNIX for Dummies Questions & Answers
New to UNIX.
I saw these messages in my logs.
What do they mean? What is a forward and reverse map?
Unable to add forward map from Rogers.ga.com to 205.150.86.252: timed out
unable to add reverse map from 241.86.150.205.in-addr.arpa. to FFXXB2RNHR71.NA.XOM.COM: timed out (2 Replies)
Discussion started by: mojoman
2 Replies
7. Shell Programming and Scripting
Hi Everyone,
I have an issue and trying to get a solution but was not succesful yet. Any help is greatly appreciated.
I am using ksh to inoke sql loader to load data from txt file into two oracle tables based on the condition written in the control file. If an error occurs while loading into... (8 Replies)
Discussion started by: vpv0002
8 Replies
8. AIX
Hi,
Can you please look into the below errors from syslog in AIX?
And let me know is this a issue? How can I avoid these errors with out affecting my LPAR.
Detail Data
SYSLOG MESSAGE
<27>Aug 23 08:24:28 syslog: slp: 0660-084 The SA failed to decode and compute received message:... (0 Replies)
Discussion started by: System Admin 77
0 Replies
9. SuSE
How are you?
SUSE V10 and 11.
In /var/log/messages I see these lines in some servers. I'd like to know what causes these errors and how to fix them.
Thank you,
error: PAM: Authentication failure for root from XXXXXXXX
Did not receive identification string from XXXXXXX
Invalid user suse-gm... (2 Replies)
Discussion started by: JDBA
2 Replies
exit(1) User Commands exit(1)
NAME
exit, return, goto - shell built-in functions to enable the execution of the shell to advance beyond its sequence of steps
SYNOPSIS
sh
exit [n]
return [n]
csh
exit [ ( expr )]
goto label
ksh
*exit [n]
*return [n]
DESCRIPTION
sh
exit will cause the calling shell or shell script to exit with the exit status specified by n. If n is omitted the exit status is that of
the last command executed (an EOF will also cause the shell to exit.)
return causes a function to exit with the return value specified by n. If n is omitted, the return status is that of the last command exe-
cuted.
csh
exit will cause the calling shell or shell script to exit, either with the value of the status variable or with the value specified by the
expression expr.
The goto built-in uses a specified label as a search string amongst commands. The shell rewinds its input as much as possible and searches
for a line of the form label: possibly preceded by space or tab characters. Execution continues after the indicated line. It is an error to
jump to a label that occurs between a while or for built-in command and its corresponding end.
ksh
exit will cause the calling shell or shell script to exit with the exit status specified by n. The value will be the least significant 8
bits of the specified status. If n is omitted then the exit status is that of the last command executed. When exit occurs when executing
a trap, the last command refers to the command that executed before the trap was invoked. An end-of-file will also cause the shell to exit
except for a shell which has the ignoreeof option (See set below) turned on.
return causes a shell function or '.' script to return to the invoking script with the return status specified by n. The value will be the
least significant 8 bits of the specified status. If n is omitted then the return status is that of the last command executed. If return
is invoked while not in a function or a '.' script, then it is the same as an exit.
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.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
break(1), csh(1), ksh(1), sh(1), attributes(5)
SunOS 5.10 15 Apr 1994 exit(1)