06-06-2008
exit status of eval exec
I am using ksh88 and I am trying to catch the return status of opening a file using a file descriptor and the exec and eval commands. However I am not having much success. Here is what I have:
eval "exec $next_fh>$1"
This opens the file if the file is $1 is valid, however I want to make sure it is valid. I tried:
command eval "exec $next_fh>$1" || print -u2 "Unable to open log file: $1"; return 1
This works, but I return the $next_fh value to the calling script and for some reason it does not execute the print above but it is evaluated and returned to the calling script and I get a bad file descriptor.
Any help would be appreciated. Thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i downloaded a text file from metalab.unc.edu called sh.txt and in this reference manual it refers to shell scripting exit status .. at the end of one of the examples that author gave an exit status of 127..
to what does a 127 exit status refer too and what is its purpose in the code.
moxxx68 (1 Reply)
Discussion started by: moxxx68
1 Replies
2. AIX
After upgrading to IS 4.0 Sp4 I am now recieving an error when running initfnsw start
Exec of 'dbupgrade' returned non-zero status of '0x1'
This error appears right after trying to start the Oracle Database.
This stops the FileNet software from starting. After many different attempts at... (0 Replies)
Discussion started by: jderocco
0 Replies
3. Shell Programming and Scripting
I want to get a status code array for the commands in eval.
For example,
eval "ls abc; ls def; ls $HOME"
I want to get the status code for each ls command in eval. Is there any way to make it?
Thanks. (2 Replies)
Discussion started by: pankai
2 Replies
4. Shell Programming and Scripting
Hi, experts.
Whould anybody clear explay me difference and usage of these 3 commands (particulary in bash) :
exec
eval
source
I've tryed to read the manual pages but did not get much.
Also could not get something useful from Google search - just so much and so not exactly, that is... (3 Replies)
Discussion started by: alex_5161
3 Replies
5. Shell Programming and Scripting
I'm preparing for exam and one of exams is to write own test command...
I wonder if in unix is a command which just returns exit code you specify..
I know I can easily write a function like this:
exStatus() {
return $1
}
-> my question is rather theoretical
thank you! (9 Replies)
Discussion started by: MartyIX
9 Replies
6. Shell Programming and Scripting
Hi
I have a little problem with the find command in a script that I'm writing. The script should check if there are some files younger than 100 seconds and then syncronise them with rsync.
My find command:
find -type f -cmin -100 -exec rsync -a --delete directory1/ directory2/
When I... (8 Replies)
Discussion started by: oku
8 Replies
7. SCO
hi all
when ever i power on my sco server it give me the message:PANIC: exit - cannot exec /etc/init (PID 1), status 0*00000200. its not booting. any help?? (1 Reply)
Discussion started by: Danish
1 Replies
8. Shell Programming and Scripting
how do i get the exit status from a ksh or perl script executed in a java program using Runtime? (1 Reply)
Discussion started by: twk
1 Replies
9. Shell Programming and Scripting
I have a shell script (#!/bin/sh) that interacts with Appworx and Banner Admin. In my script I want to check the exit status of awrun before continuing. awrun can run for 10 seconds or it can run for over a minute. So my question is, will it go through my if statement before awrun may even be... (2 Replies)
Discussion started by: smkremer
2 Replies
10. SCO
Hi to all, I hope that you can help me with this...
SCO Unix 5.0.5, old mashine Pentium III x86, SCSI HDD 36.4 Gb
PANIC: exit – Cannot exec /etc/init (PID 1), status 0x00000200
Cannot dump 49055 pages to dumpdev hd (1/41) : space for only 48640 pages
Dump not completed
Safe to Power Off... (1 Reply)
Discussion started by: lakicevic
1 Replies