bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exit status issue


From: Dallas Clement
Subject: Re: exit status issue
Date: Fri, 18 Nov 2011 14:49:54 -0600

On Fri, Nov 18, 2011 at 2:35 PM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> On Fri, Nov 18, 2011 at 02:23:54PM -0600, Dallas Clement wrote:
>> [pid  6747] execve("/bin/touch", ["touch", "/mnt/array1/.accesstest"],
>> [/* 14 vars */]) = 0
>>
>> The = 0 at the end is the exit status.
>
> That is the return value of the execve() call.  All it means is that
> the /bin/touch program was successfully launched.
>
> $ strace -f bash -c false
> ...
> execve("/bin/bash", ["bash", "-c", "false"], [/* 32 vars */]) = 0
> ...
>
> arc3:~$ bash -c false; echo $?
> 1
>

Yes, you are sure right on all counts.  The (0) in SIGCHLD (Child
exited) @ 0 (0) is clearly not the exit status of the child either.
Proven by a simple test script.

#!/tmp/bash3

touch /bogus/file
echo $?

-------------

root@TS-2RVED8:/tmp# strace -f -e execve ./test.sh
execve("./test.sh", ["./test.sh"], [/* 15 vars */]) = 0
Process 7269 attached
Process 7268 suspended
[pid  7269] execve("/bin/touch", ["touch", "/bogus/file"], [/* 14 vars */]) = 0
touch: /bogus/file: No such file or directory
Process 7268 resumed
Process 7269 detached
--- SIGCHLD (Child exited) @ 0 (0) ---
1
Process 7268 detached

Thanks for setting me straight guys.  I was misled.  It looks like the
'touch' command really could be failing in my script.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]